Understanding Statements
Explore how statements form the basic building blocks of computer programs by combining expressions and operators. Understand how the order of operations affects code execution and learn to write compound statements with clear logic. This lesson helps you grasp the role of statements in controlling program flow and storing data.
We'll cover the following...
Statements and expressions
In many programming languages, the sequence of code that we write is made up of what are called statements. A statement expresses some action to be carried out and is made up of several internal components. These are called expressions.
Statements are made up of expressions, and expressions are made up of even smaller parts. Let’s refer to an example:
5 + 4
This is an expression made up of three parts. Here, we’re using the addition operator, +. On both sides of the operator, we have the operands in the form of two constant values, 5 and 4.
A statement can be made up of more than one expression. ...