Skip to content

Instantly share code, notes, and snippets.

@ReneSac
Last active August 29, 2015 13:56
Show Gist options
  • Save ReneSac/d14e00e60dfe052ebd10 to your computer and use it in GitHub Desktop.
Save ReneSac/d14e00e60dfe052ebd10 to your computer and use it in GitHub Desktop.
template maybeMod(x: Tinteger, module:Natural) =
when module > 0: x mod module
else: x
let a = 1.maybeMod(0) # Error: value returned by statement has to be discarded
proc foo(a,b) =
generalFoo(a,b)
template generalFoo(a,b,c=0)
a.maybeMod(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment