Skip to content
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

Update switchCase.adoc #695

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Mikkel-danielsen
Copy link

@Mikkel-danielsen Mikkel-danielsen commented Aug 1, 2019

A good thing to know, I had a lot of trubleshooting befor I found out. ;)
You get no errors. The first case with variable declaration works, but noe case after it.

A good thing to know, A had a lot of trubleshooting befor I found out. ;)
Copy link
Collaborator

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your pull request @Mikkel-danielsen. I also think this would be a useful thing to document. I have some suggestions for improvements.

Language/Structure/Control Structure/switchCase.adoc Outdated Show resolved Hide resolved
Language/Structure/Control Structure/switchCase.adoc Outdated Show resolved Hide resolved
Language/Structure/Control Structure/switchCase.adoc Outdated Show resolved Hide resolved
Language/Structure/Control Structure/switchCase.adoc Outdated Show resolved Hide resolved
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

Moved the new example code to the "Notes and Warnings".
@Mikkel-danielsen
Copy link
Author

Are there somthing I need to do here now? I am not sure how this works.

@per1234 per1234 self-assigned this May 7, 2022
@@ -71,7 +70,7 @@ switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
case 2:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case 2:
case 2:

Remove the trailing space that snuck in here as part of the proposal.

@@ -52,7 +52,6 @@ switch (var) {
=== Returns
Nothing

--
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block delimiter markup is required in order for the document to be valid AsciiDoc.

[float]
=== Notes and Warnings
// Add useful notes, tips, caveat, known issues, and warnings about this Reference term
If you need to declare a variable in a case, use curly brackets {} to define a scope within the case statement to avoid a "crosses initialization of" compiler error.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you need to declare a variable in a case, use curly brackets {} to define a scope within the case statement to avoid a "crosses initialization of" compiler error.
If you need to declare a variable for use in a case, use link:../../further-syntax/curlybraces[curly braces] (`{`, `}`) to define a scope within the case statement to avoid a "crosses initialization of" compiler error.

}
default:
// if nothing else matches, do the default
// default is optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// default is optional

This information does not add any value to the demonstration of the use of braces to create a scope in a case and has already been mentioned in the existing general example sketch.

@per1234
Copy link
Collaborator

per1234 commented Jun 1, 2022

Hi @Mikkel-danielsen. I wanted to check back in with you. If you will update the pull request according to the instructions I provided above I will be happy to merge this valuable pull request.

@per1234 per1234 added the on hold The PR should not be merged at this time label Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement on hold The PR should not be merged at this time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants