Summary
-
The
break
expression causes afor
,while
, orloop
expression to exit immediately -
The
continue
expression causesfor
,while,
andloop
expressions to stop processing the current body, and continue with the next iteration -
The
return
keyword causes a function to exit immediately -
The
return
keyword can take a value to return from the function -
If
return
is used without a value, it returns unit()
-
The
?
operator can be appended to any expression, and causes “None
propagation” -
The
?
operator also works on other types, such asResult
-
The
main
function is allowed to return aResult
, which can be used to indicate that a program failed
Get hands-on with 1400+ tech skills courses.