File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file
2+
3+ * @ jinzhongjia @ jiacai2050 @ xihale
4+ * .json @ jinzhongjia
5+ bun.lock @ jinzhongjia
Original file line number Diff line number Diff line change 1+ name : Mirror
2+
3+ on :
4+ push :
5+ branches : [main, master]
6+ workflow_dispatch :
7+
8+ jobs :
9+ atomgit :
10+ if : github.repository_owner == 'zigcc'
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v3
14+ with :
15+ fetch-depth : 0
16+ - uses : pixta-dev/repository-mirroring-action@v1
17+ with :
18+ target_repo_url : https://jiacai2050:${{ secrets.ATOMGIT_TOKEN }}@atomgit.com/${{ github.repository }}.git
Original file line number Diff line number Diff line change 1+ name : opencode
2+
3+ on :
4+ issue_comment :
5+ types : [created]
6+ pull_request_review_comment :
7+ types : [created]
8+
9+ jobs :
10+ opencode :
11+ if : |
12+ contains(github.event.comment.body, ' /oc') ||
13+ startsWith(github.event.comment.body, '/oc') ||
14+ contains(github.event.comment.body, ' /opencode') ||
15+ startsWith(github.event.comment.body, '/opencode')
16+ runs-on : ubuntu-latest
17+ permissions :
18+ id-token : write
19+ contents : read
20+ pull-requests : read
21+ issues : read
22+ steps :
23+ - name : Checkout repository
24+ uses : actions/checkout@v6
25+ with :
26+ persist-credentials : false
27+
28+ - name : Run opencode
29+ uses : anomalyco/opencode/github@latest
30+ env :
31+ OPENCODE_API_KEY : ${{ secrets.OPENCODE_API_KEY }}
32+ with :
33+ model : opencode/glm-5.1
Original file line number Diff line number Diff line change @@ -98,7 +98,26 @@ for 循环是另一种循环处理方式,主要用于迭代数组和切片。
9898
9999### ` continue ` 表达式
100100
101- ` while ` 循环还支持一个被称为 ` continue ` 表达式的机制,以便于我们控制循环。其内部可以是一个语句或一个代码块(由 ` {} ` 包裹)。
101+ ` while ` 循环的条件之后可以用冒号 ` : ` 跟一个括号来声明 ** ` continue ` 表达式** ,它会在** 每轮循环体结束后、下一轮条件判断之前** 自动执行:
102+
103+ <<<@/code/release/loop.zig#while_continue_fix
104+
105+ 每轮循环的执行顺序是:
106+
107+ 1 . 检查条件 ` i < 10 `
108+ 2 . 执行循环体
109+ 3 . 执行 ` continue ` 表达式 ` i += 1 `
110+ 4 . 回到第 1 步
111+
112+ 相信看到这里,细心的读者可能已经发现了,在上面的 while 基本使用示例中,当循环执行到 ` i == 5 ` 时,** 代码会陷入死循环** 。
113+
114+ 而 ` continue ` 表达式会帮助我们完美地避开这个问题,不难发现,即使循环执行到 ` i == 5 ` 时,` i ` 的自增仍然会在 ` continue ` 表达式内执行。
115+
116+ :::info 🅿️ 提示
117+ 除了 break 以外,return 也会导致 continue 表达式不执行,因为它们都会直接跳出循环。
118+ :::
119+
120+ 另外,` continue ` 表达式可以是单个语句,也可以是多个语句(用 ` {} ` 包裹),示例如下:
102121
103122::: code-group
104123
Original file line number Diff line number Diff line change @@ -171,7 +171,20 @@ const WhileBasic = struct {
171171};
172172
173173const WhileContinue = struct {
174+ const std = @import ("std" );
175+
174176 pub fn main () void {
177+ {
178+ // #region while_continue_fix
179+ // 将while语句的基础代码用continue表达式改写
180+ var i : usize = 0 ;
181+ while (i < 10 ) : (i += 1 ) {
182+ if (i == 5 ) continue ;
183+ std .debug .print ("i is {}\n " , .{i });
184+ }
185+ // #endregion while_continue_fix
186+ }
187+
175188 {
176189 // #region while_continue_1
177190 var i : usize = 0 ;
Original file line number Diff line number Diff line change 99 "export-pdf" : " press-export-pdf export course"
1010 },
1111 "devDependencies" : {
12- "@types/node" : " ^25.2 .0" ,
13- "prettier" : " ^3.8.1 " ,
12+ "@types/node" : " ^25.6 .0" ,
13+ "prettier" : " ^3.8.2 " ,
1414 "vitepress" : " ^1.6.4" ,
1515 "vitepress-export-pdf" : " ^1.0.0"
1616 },
You can’t perform that action at this time.
0 commit comments