Skip to content

Control Flows

In this section, we talk about how the ussd language allows you to control the flow of a program.

With the help of if-else we can create two branches in our USSD flow that depends on the truthiness or falsiness of a variable.

Example USSD application branching based on whether a user entered a value or not

Since the if block runs when the variable has a value, and the else block also runs when the variable has no value. The compiler wouldn’t allow you to use a variable that has been checked with an if statement in its corresponding else block.

The error is shown because in that else block, the variable tool has no value. Hence, can’t be used

coming soon!