You don't need to quote anything with a ` in a template
You mixed up the variable `i` in the quote section. You only want to
interpolate (``i``) for variables created outside the quote section:
macro foo(c: char, s: string) =
result = quote do:
echo `s`
for i in `s`:
if i == `c`: echo `c`
Run
How do we have `for i in` loop inside quote do macro due to this keep on error:
macro foo(c :char; s :string) =
result = quote do:
var
i :char
echo `s`
for `i` in `s`:
if `i`==`c` : echo `c`
foo('l', "hello")
Run