Trace a REPEAT UNTIL loop逐步追踪 REPEAT UNTIL 循环
Run one AP CSP pseudocode statement or condition check at a time. Watch total and k change.每次执行一条 AP CSP 伪代码语句或检查一次条件,观察 total 和 k 的变化。
Code代码
- total ← 0
- k ← 1
- REPEAT UNTIL (k > 5) {
- total ← total + k
- k ← k + 1
- }
- DISPLAY(total)
State状态
| Variable变量 | Value值 |
|---|---|
| total | 0 |
| k | — |
| Condition条件 | — |
| Output输出 | — |
Use ← and → to step. The note explains each comparison and change.使用 ← 和 → 逐步运行。每次比较和变化见下方说明。