News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

A thought on procedures

Started by JohnB, Apr 29, 2025, 08:53 AM

Previous topic - Next topic

JohnB

When passing parameters in a procedure could we have a default value to be applied if not passed in the call. A bit like preassigned value for Dim statements.

 e.g. Proc MyProc(param0 as byte, param1 As byte, param2 As Byte = 0)
 
This would allow procedure calls with variable number of parameters.
JohnB

RGV250

Hi John,
I am not sure if I understand, if you are passing a parameter it will already have a value when the procedure is called so would make the default value irrelevant. Would this be optional, if not what happens when you have a procedure without any parameters?

Regards,
Bob