DEV Community

Calvin
Calvin

Posted on

Reading Snippets [21]

Expressions and statements may seem very similar but they are actually quite different.

An expression is a piece of code that becomes a value. A statement, on the other hand, performs actions and controls actions but does not become a value.

Knowing the difference between an expression and statement can open one up to new experiences in reading their code and finding bugs.

For example, with an understanding of the difference between expressions and values, one would know that a statement cannot be put where an expression is expected.

Top comments (0)