Re: Thinking of buying PureBasic but have some questions :)
Posted: Sat Sep 29, 2012 2:43 pm
Easy. Every macro parameter is just text replaced with its argument.tastyraspberry wrote:@danilo
Haven't quite got my head around the macro way yet. I'm sitting here tinkering away today so I am sure I can work it out later.
If '#' is used, the text is merged/consolidated/concatenated.
Code: Select all
Macro Value(_theValue_)
Debug _theValue_
EndMacro
Value(12) ; = Debug 12
Value(x) ; = Debug x
x=5
Value(x) ; = Debug x = Debug 5
Macro DQ
"
EndMacro
Macro Concat(_type_)
Procedure _DebugType_#_type_()
Debug DQ#_type_#DQ ; debug "_type_"
EndProcedure
_DebugType_#_type_()
EndMacro
Concat(l) ; creates procedure _DebugType_l and calls _DebugType_l
Concat(i) ; creates procedure _DebugType_i and calls _DebugType_i
Concat(s) ; creates procedure _DebugType_s and calls _DebugType_s