aboutsummaryrefslogtreecommitdiff
path: root/examples/coroutines/README.md
blob: 644c0e07d900eb9d4404866405d656862e3945f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Tomo Coroutine Library

This is a coroutine library built on top of a modified version of
[libaco](https://libaco.org).

## Example Usage

```ini
# modules.ini
[coroutines]
version=v1.0
```

```tomo
use coroutines

func main()
    co := Coroutine(func()
        say("I'm in the coroutine!")
        yield()
        say("I'm back in the coroutine!")
    )
    >> co
    say("I'm in the main func")
    >> co.resume()
    say("I'm back in the main func")
    >> co.resume()
    say("I'm back in the main func again")
    >> co.resume()
```