Python Tanks - If - the conditional statement

Another useful structure is "if". It works similar to "while", but the commands inside are executed only once, if the condition is correct.
We also can put "whiles" and "ifs" inside each other (adding 4 spaces to indentation each time).
In this exercise we use "if" to check with the help of call to "look_below()" function if there is a star under the tank, so we can collect it. Note the '==' operator which means "equals". So the condition is "if look_below equals star"...

Prev
#this code moves tank as long as it can #and picks stars when it finds them #note that content of both "while" and "if" #is indented with 4 spaces relative to "parent" block right() while look_ahead() != 'out': if look_below() == 'star': pick() forward() left() #run this code, then add more #to collect the stars from the upper passage