Skip to content

Expressions


layout: default title: Expressions: Where the Work Gets Done


Statements are roughly equivalent to sentences in a language, and make up a complete instruction to the computer.

Expressions are the parts that make up statements.

expression

a combination of literals, variables, and operators.

operator

a symbol in your source code that specifies an operation to be performed on some data (its operands).

There are several types of expressions: * Assignment expressions — assign data to a variable.

  age = 29
* Arithmetic expressions — perform arithmetic calculations.
  5 + 3
* Relational expressions — come up with a true/false answer to a question.
  i < 10
* Logical expressions — combine multiple true/false answers into one by using more operators.
  i < 10 && j > 5


Prev -- Up -- Next