Why does passing this optional proc not work or what am I doing wrong?
import options
type FooFunc = proc(x: int)
proc foo(x: int) = echo "It works OK!!!"
proc testFoo(param1: string, f = none(FooFunc)) =
echo "param1 = ", param1
if f.isSome:
(f.get)(3)
testFoo("String works")
testFoo("Passing optional proc does not work", f = some(foo))
Run
- Passing an optional proc is not working TKD
