Skip to content

Instantly share code, notes, and snippets.

@rayman22201
Created September 22, 2018 00:24
Show Gist options
  • Save rayman22201/ffa0a3274800d4cefc11f1d3a25368a9 to your computer and use it in GitHub Desktop.
Save rayman22201/ffa0a3274800d4cefc11f1d3a25368a9 to your computer and use it in GitHub Desktop.
Macro Counting in Nim
import macros
static:
var countCall = 0
macro countCalls(): untyped =
countCall = countCall + 1
return countCall
let a = countCalls()
let b = countCalls()
let c = countCalls()
echo "final count : ", c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment