optional variables
BlitzPlus Forums/BlitzPlus Programming/optional variables
| ||
Is there a way in B+ to have optional variables in functions? Like a vairable that the user can set when calling the function, but if it isn't set defaults to a predetermined value? |
| ||
Yes. Here's an example:Out("Hello") Out("Twice", 2) WaitKey Function Out(s$, count%=1) For i = 1 To count Print s$ Next End Function Just make sure the optional parameters are specified after the others. |
| ||
Nice thanks, thats just what i needed. |