macro call syntax- confused

moorea21

Senior Member
This is probably going to be another obvious one, but having looked at the manual and examples, this is not yet obvious to me:

Code:
#macro clearRow(b5):
  'code involving b5 in some way
#endmacro
in main:
Code:
For b5 = 1 to 8
  clearRow(b5)
'etc
What do I have to write instead of 'clearRow(b5)' to get the variable b5 passed into the macro?
 

techElder

Well-known member
When you DEFINE your #macro, the variables that you use are just placeholders; not the real variables. The #macro is sort of like a template.

When you actually reference you macro in your code space, you pass the real variable as the parameter.

Your confusion might be in defining the macro and thinking that you have to use the real variable there. Almost anything goes in the definition.

I don't see anything wrong with your example (except it isn't complete.) :D
 

BESQUEUT

Senior Member
This is probably going to be another obvious one, but having looked at the manual and examples, this is not yet obvious to me

What do I have to write instead of 'clearRow(b5)' to get the variable b5 passed into the macro?
As said by Texasclodhopper, an example may be usefull :
Code:
#macro clearRow(zzz):
  'code involving zzz in some way
    b6=b6+zzz
#endmacro
Code:
b6=0
For b5 = 1 to 8
    clearRow(b5)
next b5
sertxd(#b6,13,10)
 

hippy

Technical Support
Staff member
As said, the 'parameter thing' in the macro definition can be any name ...

Code:
#Macro PrintNumber(varOrNumber)
  SerTxd( #varOrNumber, CR, LF )
#EndMacro

PrintNumber(12345)
PrintNumber(bit0)
PrintNumber(b1)
PrintNumber(w1)
 
Top