Skip to content

Commit c8cce89

Browse files
committed
添加 => 17 流程控制语句
1 parent cc307e0 commit c8cce89

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
void main() {
2+
// if else
3+
// bool isPrint = true;
4+
// if (isPrint) {
5+
// print('hello');
6+
// }
7+
8+
// for
9+
// for (var i = 0; i < 5; i++) {
10+
// print(i);
11+
// }
12+
13+
// while
14+
// bool isDone = false;
15+
// while(!isDone) {
16+
// print('is not done');
17+
// isDone = true;
18+
// }
19+
20+
// do while
21+
// bool isRunning = true;
22+
// do {
23+
// print('is running');
24+
// isRunning = false;
25+
// } while (isRunning);
26+
27+
// switch case
28+
// String name = 'cat';
29+
// switch (name) {
30+
// case 'cat':
31+
// print('cat');
32+
// break;
33+
// default:
34+
// print('not find');
35+
// }
36+
37+
// break
38+
// num i = 1;
39+
// while(true) {
40+
// print('${i} - run');
41+
// i++;
42+
// if(i == 5) {
43+
// break;
44+
// }
45+
// }
46+
47+
// continue
48+
// for (var i = 0; i < 5; i++) {
49+
// if (i < 3) {
50+
// continue;
51+
// }
52+
// print(i);
53+
// }
54+
55+
// continue 指定位置
56+
// String command = "close";
57+
// switch(command) {
58+
// case "open":
59+
// print("open");
60+
// break;
61+
// case "close":
62+
// print("close");
63+
// continue doClose;
64+
65+
// doClose:
66+
// case "doClose":
67+
// print("DO_CLOSE");
68+
// break;
69+
70+
// default:
71+
// print("-----");
72+
// }
73+
}

0 commit comments

Comments
 (0)