Using eval within a function

You can avoid macros by passing in the function directly:

function build_string(A, comp, B)
  if comp(A, B)
   [...]
end

build_string(A, <=, B) # for some variables A and B
2 Likes