A value was expected here (after an operator, =, ( or ,) but the next token can't start
one. Auk closures are written x => ..., never fn (x) ....
Wrong#
fn double(xs: [int]): [int] = xs.map(fn(x) x * 2)Fixed#
fn double(xs: [int]): [int] = xs.map(x => x * 2)Common causes#
- A closure written with
fn,|x|orlambda: writex => ...or(a, b) => .... - A dangling operator:
a + * b, or a trailing+with nothing after it. _used as a value; it only works in patterns.assertused inside an expression; it is a statement.