Skip to content

Instantly share code, notes, and snippets.

@MattAlp
Created August 5, 2023 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattAlp/515201460c6640ff624381a81e455a90 to your computer and use it in GitHub Desktop.
Save MattAlp/515201460c6640ff624381a81e455a90 to your computer and use it in GitHub Desktop.
From Discord in response to my macro
template nfor(name:string, idx: untyped, loop_range: untyped, body:untyped): untyped =
block `name`:
for `idx`{.inject.} in `loop_range`:
`body`
nfor "outer", i, 0..5:
nfor "inner", j, 0..5:
echo i, j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment