Macros improvements?

Started by Frank Brübach, July 14, 2024, 10:04:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank Brübach

Hello Charles..

Yesterday I have Made simple Tests noticed some similar macro Test at freebasic..

' test macros
'
macro join (a,b)  'macro join ? (a,b) 'no way
'a & b 'doesnt work with &
   a + b
end macro

print join 2,4 '6 go
print join "a","b" '' ab go
print join ("a","b") '' ab go

dim s1 as string = join (3,8) '11 -> ok
'dim s1 as string = join 3,8 ' doesnt work without () , not ok, undefined type for 8

print s1 '11 ok


dim s1 as string = join ("W","Y") + join ("X", "Y")
'dim s1 as string = join "W","Y" '' + join + "X", "Y" '  undefined type for "Y" problem
print s1

dim s2 as string = join ("W","Y") + join ("X", "Y")

'dim s3 as string = join( "W"  + join( "X", "Y") ) ' not found [b
'dim s4 as string = join + join ("W", "X") '' not found [b


print s2  '' WYXY WYXY
'print s3 
'print s4

macro cube(v)
v*v*v
end macro

print cube 3 '27 ok

macro cube(v)
v+v-v
end macro

print cube "a","c" 'aaac ok