This is a straight forward ‘decision block’. It asked a single question and follows different paths depending on the result of the question asked: Is the time after 12 O’Clock.
The question (or condition) to check has been put inside brackets in the code but this is only to make it clearer later on. You don’t need the brackets around the question but it can help when things get a bit more involved.
The question (condition) asked is: Is the number returned by Clock.Hour more than 12.
If it is then the program displays the greeting ‘Good afternoon’, otherwise the program skips that section up to the ‘Else’ keyword and displays the greeting ‘Good morning’. Only one of the messages is displayed. The block then ends and the next line of code is executed so you always see the message: ‘Have a good coding day’.
The above example is not strictly correct – it doesn’t quite work as expected. Can you see why? If you can then correct it. You should also try using different questions as it can also be written in a number of different ways and still get the required output. This is true of ALL conditional statements – there are always several different ways to write them.