You can do anything with macros, but in your case, you need the do notation
like Hlaaftana showed and templates are enough:
proc yes(): bool = true
proc no(): bool = false
template myPattern(proc1, proc2, proc3: untyped): untyped =
var wasProc2Called = false
if proc1():
proc2
wasProc2Called = true
else:
proc3
myPattern(no): # myPattern(no)
# if yes
echo "statement 1"
echo "statement 2"
do: # If no
echo "statement 3"
echo "statement 4"
Run
- Macro - whileSome: none: markprocess
- Re: Macro - whileSome: none: mratsim
- Re: Macro - whileSome: none: markprocess
- Re: Macro - whileSome: none: mashingan
- Re: Macro - whileSome: none: Hlaaftana
- Re: Macro - whileSome: none: mratsim
- Re: Macro - whileSome: none: LeuGim
