The hardest part of writing an IF statement is finding 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 conditional statement needed to move ahead 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 on an island without other Jeroos | if(!isWater(AHEAD) && !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