Back to Sway

Control Flow

docs/reference/src/documentation/language/control-flow/index.md

0.71.0441 B
Original Source

Control Flow

A control flow in a program is the order in which instructions are executed.

For example, a function may take an input u64 and if the value is greater than 5 then it calls one function otherwise it calls a different function.

Controlling the order of instructions can be done through the use of conditional expressions such as if and match and through looping.