> On May 16, 2019, at 2:28 PM, John Rose <[email protected]> wrote:
>
> Chapter 1. Some constructs have arrows.
> They define when the arrow bodies are executed,
> and, if the the arrow gets tossed a value, what
> is done with that value (method return?
> switch result? block result? depends on
> where the arrow is).
>
> Chapter 2. Every yield matches an innermost
> arrow, and every arrow (in a non-void T context)
> accepts a yielded value (of type T).
Reminder: the <break replacement> statement can be used in two contexts:
arrow-based switch rules and label-based switch blocks.
int i = switch (foo) {
case "a" -> { yield 1; }
case "b" -> { yield 2; }
default: -> { yield 0; }
};
int j = switch (foo) {
case "a": yield 1;
case "b": yield 2;
default: yield 0;
};