MandatoryAssignment
DRAFT

Misconception:

An expression is not a valid statement on its own and must then be assigned to something to reach a valid statement.

Incorrect

An expression must be assigned to have a valid statement

Correct

An expression alone, without an assignment, is already a valid statement

Correction
Here is what's right.

Among different types of statements, we have expression statements. This means that an expression on its own already constitutes a valid statement.

Consider this code that contains two valid statements. The first one assigns 3 to the constant a, while the second one just computes the value 3.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.