Conditional expressions in Go
An if
statement begins with the keyword if
, followed by some expression that evaluates to either true
of false
, and then curly braces that delimit the scope of the statement.
The expression is called conditional expressions because it specifies the condition under which the scope should be executed.
true
and false
are boolean values. In Go they have the type bool
.