返回void意味着函数不返回任何内容:
proc saySomething(): void =
echo "something"
Run Code Online (Sandbox Code Playgroud)
空括号以及: void可选:
proc saySomething =
echo "something"
Run Code Online (Sandbox Code Playgroud)
注释函数noReturn意味着函数根本不会返回:
proc killTheProgram {.noReturn.} =
quit(0)
proc raiseSomething {.noReturn.} =
raise newException(ValueError, "Something")
Run Code Online (Sandbox Code Playgroud)