That's very easy to fix, use a `block` to avoid clash of identifiers:
template tapIt*[T](obj: T, code: untyped): T =
block:
let it {.inject.} = obj
code
it
var num = 123
echo num.tapIt(echo 2 * it)
echo num.tapIt(echo 3 * it)
Run
- Nim implementation of Ruby tap() method DMisener
- Nim implementation of Ruby tap() method juancarlospaco
- Nim implementation of Ruby tap() method xigoi
- Nim implementation of Ruby tap() method xigoi
- Nim implementation of Ruby tap() method DMisener
- Nim implementation of Ruby tap() meth... DMisener
- Nim implementation of Ruby tap() ... DMisener
- Nim implementation of Ruby ta... janAkali
- Nim implementation of Ruby ta... DMisener
- Nim implementation of Ruby ta... xigoi
- Nim implementation of Ruby ta... demotomohiro
