What does a func
with return type Never
do?
For example:
func addNums() -> Nev
Never
indicates that the function will never return. It's intended to be used for things like fatalError
which cause your program to crash intentionally, often after logging an error. You probably shouldn't use it unless you're doing something like making a handler for catastrophic errors in your application.
This is different from a function which just doesn't return a value, as in your second snippet. You could also write that as func addNums() -> Void
.