Create conditional statements using If-Else blocks

Conditional statements are central to creating interactive elearning. They make it possible to express statements like:

If blocks

The simplest conditional statement is an if block, as shown:

Simple If Block

When run, this will check to see if the value of the variable score is greater than or equal to 90. If it is, Text 1 will display "Wow, you really know your stuff!". Otherwise, nothing happens.

If-Else blocks

It is also possible to specify that something should happen if the condition is not true, as shown in this example:

If-Else Block

As with the previous block, this will check to see if the value of the variable score is greater than or equal to 90. If it is, Text 1 will display "Wow, you really know your stuff!". Otherwise, Text 1 will display "Wow, you really know your stuff!"

If-Else-If blocks

It is also possible to test multiple conditions with a single if block by adding else if clauses:

If-Else-If Blocks