Skip to content

Commit

Permalink
Updated note on arrow notation (#5854)
Browse files Browse the repository at this point in the history
Fixes #4582
  • Loading branch information
atsansone authored May 24, 2024
1 parent 3bbc54b commit bb43daf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/content/language/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ The <code>=> <em>expr</em></code> syntax is a shorthand for
is sometimes referred to as _arrow_ syntax.

:::note
Only an *expression*—not a *statement*—can appear between the arrow (=\>) and
the semicolon (;). For example, you can't put an [if statement][]
there, but you can use a [conditional expression][].
Only _expressions_ can appear between the arrow (`=\>`) and the semicolon (`;`).
Expressions evaluate to values.
This means that you can't write a statement where Dart expects a value.
For example,
you could use a [conditional expression][] but not an [if statement][].
In the previous example,
`_nobleGases[atomicNumber] != null;` returns a boolean value.
The function then returns a boolean value
that indicates whether the `atomicNumber` falls into the noble gas range.
:::

## Parameters
Expand Down

0 comments on commit bb43daf

Please sign in to comment.