The hardest part of writing an IF statement is knowing how to write the condition you need.
For example: The obstacles that a Jeroo must avoid are nets and water. If a Jeroo who is alone on an island needs to know if it's safe to hop ahead then the condition needed is:
Fill in the conditions below. The first example has been filled in for you
You want to know: | the condition you need is: |
1. If it is safe to hop | if NOT isWater(AHEAD) AND NOT isNet(AHEAD) |
2. If either the Jeroo named Tia or the Jeroo named Jae has any flowers. | if |
3. If a Jeroo who is facing South is standing in the SouthWest corner of the island | if |
4. If there is another Jeroo on either side of this Jeroo. | if |
because if there is a flower ahead, it is not clear, but it is safe to hop