In Nim, the noReturn pragma marks a proc that never returns.
How is that different than a function that returns void?
void
Returning void means the function returns nothing:
proc saySomething(): void = echo "something"
The empty brackets as well as the : void are optional:
: void
proc saySomething = echo "something"
Annotating a function with noReturn means the function will not return at all:
noReturn
proc killTheProgram {.noReturn.} = quit(0) proc raiseSomething {.noReturn.} = raise newException(ValueError, "Something")
Copyright © 2021 Jogjafile Inc.
Returning
void
means the function returns nothing:The empty brackets as well as the
: void
are optional:Annotating a function with
noReturn
means the function will not return at all: