Call for bikeshed -- break replacement in expression switch
Dan Smith
daniel.smith at oracle.com
Fri May 17 18:21:12 UTC 2019
> On May 16, 2019, at 2:28 PM, John Rose <john.r.rose at oracle.com> 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;
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190517/3b874653/attachment.html>
More information about the amber-spec-experts
mailing list