Download presentation
Presentation is loading. Please wait.
Published byMaximillian Carroll Modified over 9 years ago
1
selection structures in Jeroo! if, if else, if, else if, else if, else
2
if else ladder - a multi-way selection Rules: each condition must be in parentheses no semicolon after the parentheses no limit on the number of else if blocks the final else branch is option
3
if(Louisa.isFlower(AHEAD) { Louisa.hop(); Louisa.pick(); } else if(Louisa.isNet(AHEAD) { LouisA.toss(); } else if(Louisa.isWater(AHEAD) { Louisa.plant(); } else {hop(); turn(RIGHT); }
4
COMPOUND CONDITIONS OPERATORJEROO SYMBOL MEANING NEGATION!NOT CONJUNCTION&&AND DISJUNCTION||OR
5
! EXAMPLE !Bob.isNet(AHEAD) //there is not a net ahead.
6
EXAMPLE Bob.hasFlower() && Bob.isClear(LEFT) //Bob has at least one flower and there is nothing in the cell immediately to the left.
7
&& EXAMPLE Bob.isFacing(WEST) && (!Bob.isNet(AHEAD) Bob is facing west and there is no net ahead.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.