-
-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain modern switch block #2893
Conversation
I didn't want to include Thanks :) |
Hey @josealonso Thanks for the contribution! You have to actually make the update here as you can see in the .docs directory we have a .md.tpl file that points to that one. What i'm thinking is that the usage of switch would depend on what version of java the students use, makes sense to teach both the newer and older version but seems weird to called them like modern or older version, maybe specify in what versions of java the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the introduction in the correct file
I think it might be confusing to mention both versions of the Other than, I'd suggest using the terms "switch statement" and "switch expressions" as I believe they commonly used to distinguish between the two. |
Thanks @manumafe98. I'm sorry I didn't modify the correct document. Regarding the Java versions, that is explained in the text I wrote. |
That's a good point. I didn't know that was possible, sorry. The best option would be to update the exercise to practice both styles, since the traditional switch block is probably the most common one. But that requires to use the Analyzer and I still have to look into that API. Thanks for the feedback @kahgoh |
That sounds okay to me.
Ah, I think I missed Patterns for Switch (JEP 441), which was added in Java 21. Switch expression came out of preview in Java 14 (according to this Wikipedia page). |
Many thanks for the link to the docs @kahgoh. I went trough several pages and I'm impressed it's so well-documented. |
Explain modern switch block
Text added to the switch block concept, explaining the modern switch statement and the switch expression.
Reviewer Resources:
Track Policies