Before, we look into decision-making and branching, let's try to understand, what is a statement. A statement is any line of code ending with a semi-colon. A statement can be an expression, a method call, a declaration or assigning a value to a variable. A block is a group of statements that form a single compound statement i.e. a block is a group of statements logically grouped together for program flow and readability. The curly braces { and } group the statements of a block. Here is an example of a block: { number1 = 30; number2 = 45; result = number1 + number2; } When the program runs and gets to this block of code, it will begin the execution at { and will not continue execution elsewhere until leaving the }. |
Course Content > Session 3 >