Here you go
const allowedInts = {1, 3, 5, 8}
proc foo(bar:static[int]) =
static: assert bar in allowedInts, "Value " & $bar & " not allowed"
echo "Success"
foo(6)
const allowedInts = {1, 3, 5, 8}
proc foo(bar:static[int]) =
static: assert bar in allowedInts, "Value " & $bar & " not allowed"
echo "Success"
foo(5)
- compile time 'asserts' jackmott
- Re: compile time 'asserts' Varriount
- Re: compile time 'asserts' mratsim
