Hi, I have a simple question on macro function.
Let say I have a macro function
macro add_one(i::Int64)
i+1
end
which does the simple thing:
@add_one 1
gives 2
as expected. Then I want to use the function inside the for loop in the following way:
for i=1:100
@add_one i
end
then, I have an error:
MethodError: no method matching @add_one(::Symbol)
Closest candidates are:
@add_one(::Int64) at Ind[94]:2
It seems like I cannot use i
, the for-loop variable, as an argument of a macro function. Are there any ways to use i
as an input for @add_one
?