marqdo

Loopsok

structure/05-loop.mq.md

文档

main

说明

Inside a function body, - starts a loop (not a parameter).

Countdown:

`n` = 3
  • n > 0
    > print text=n
    `n` = `n` - 1

Walk a table (tables are collections):

basket =
fruit
apple
pear
  • [fruit](遍历 basket 为 fruit)
    > print text=today fruit
Functions
Variables
  • basket list · 2
    #value
    1apple
    2pear
  • description text
    Condition loops and table walks
  • fruit text
    pear
  • markup text
    occlusion
  • n int
    0
  • title text
    Loops
可执行知识(辅助)

运行与结果

3 2 1 today apple today pear
完整源码
---
markup: occlusion
title: Loops
description: Condition loops and table walks
---

# main

Inside a function body, `-` starts a loop (not a parameter).

Countdown:

**`n` = 3**

- `n` > 0
  > print text=`n`
  **`n` = `n` - 1**

Walk a table (tables are collections):

`basket` =

| fruit |
|-------|
| apple |
| pear |

- [fruit](遍历 basket 为 fruit)
  > print text=today `fruit`

Variable