If you want something to occur in a function, you put it in brackets.
If you want something to occur more than once, you make a loop...and put it in brackets.
If you want something to occur only under certain conditions, you make an if...and put it in brackets.
Whenever you're ready for the loop or the conditional to end, put a closing bracket.
And to give a very big hint (although it's not one that I haven't already given) an else statement must follow immediately after the closing bracket of an if statement.