Skip to content

Commit 0182904

Browse files
Update for loop (examplehub#52)
* remove target files * run actions on pull_request Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
1 parent 2750aeb commit 0182904

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

.github/workflows/checkstyle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Code Formatter
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
checkstyle:

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: Java CI with Gradle
55

6-
on: [push]
6+
on: [push, pull_request]
77

88
jobs:
99
build:

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: Java CI with Maven
55

6-
on: [push]
6+
on: [push, pull_request]
77

88
jobs:
99
build:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.gradle
22
/build/
33
.idea/
4+
target
45

56
# Ignore Gradle GUI config
67
gradle-app.setting

src/main/java/com/examplehub/basics/ForLoop.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,32 @@ public static void main(String[] args) {
6666
}
6767
System.out.println("\n");
6868

69+
/*
70+
* 1 2 3 4 5
71+
*/
72+
int x = 0;
73+
while (true) {
74+
x++;
75+
System.out.print(x + "");
76+
if (x == 5) {
77+
break;
78+
}
79+
}
80+
System.out.println();
81+
82+
/*
83+
* 1 2 3 4 5
84+
*/
85+
int i = 0;
86+
do {
87+
i++;
88+
System.out.print(i + "");
89+
if (i == 5) {
90+
break;
91+
}
92+
} while (true);
93+
System.out.println();
94+
6995
/* infinite loop */
7096
/*
7197
for (; ; ) {

0 commit comments

Comments
 (0)