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

Fix and enhance Java snippets #276

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1777,9 +1777,8 @@ In this example, we are using the PERFORM keyword in a way that is similar to a


```JAVA
for(int counter =0; counter<11; counter++){
//move counter to msg-to-write
//write print-rec
for (int counter = 1; counter < 11; counter++) {
System.out.println("The number is: " + counter);
}
```
*Example 4. Java example*
Expand Down Expand Up @@ -2011,10 +2010,10 @@ Adding the UNTIL keyword to a perform sentence allows you to iterate over a grou
This would be equivalent to the Java code:

```JAVA
while(counter != 10){
//counter++
//move counter to msg-to-write
//write print-rec
int counter = 0;
while (counter != 10) {
counter++;
System.out.println("The number is: " + counter);
}
```
*Example 14. Java while loop*
Expand All @@ -2035,12 +2034,11 @@ In this case, the Boolean condition is evaluated before the loop is executed. H
This would be similar to a "do while" loop in Java:

```JAVA
do{
//counter++
//move counter to msg-to-write
//write print-rec
}
while(counter != 10);
int counter = 0;
do {
counter++;
System.out.println("The number is: " + counter);
} while (counter != 10);
```
*Example 16. Java while loop*

Expand Down Expand Up @@ -2069,9 +2067,9 @@ PERFORM 1000-PARAGRAPH-A
This may seem complex, but compare it to this Java pseudo-code:

```JAVA
for(int counter = 0; counter < 11; counter++){
for(int counter2 = 0; counter2 < 5; counter2++){
paragraphA();
for (int counter = 1; counter < 11; counter++) {
for (int counter2 = 1; counter2 < 5; counter2++) {
paragraphA();
}
}
```
Expand Down