Libraryless. Click here for Pure Java version (2389L/15K/56K).
1 | !7 |
2 | |
3 | !include #1004241 // Coroutines |
4 | |
5 | static int i; |
6 | |
7 | p { |
8 | // Prelude tests |
9 | |
10 | O b; |
11 | eval(b = _block( |
12 | r { print("hello"); }, |
13 | r { print("world."); })); |
14 | |
15 | stepAll(b); |
16 | |
17 | assertEquals("a", new If(func { true }, "a", "b").get()); |
18 | assertEquals("b", new If(func { false }, "a", "b").get()); |
19 | |
20 | // This is the actual coroutine. |
21 | |
22 | //stepAll_verbose = true; |
23 | stepAll_steps = 0; |
24 | |
25 | stepAll( |
26 | |
27 | // Here it goes: |
28 | |
29 | _for(r { i = 1 }, func { i <= 3 }, r { ++i }, r { |
30 | print("Counting to " + i + "!"); |
31 | } |
32 | |
33 | // Done! |
34 | |
35 | )); |
36 | |
37 | print("Steps: " + stepAll_steps); // How many coroutine steps it took. |
38 | print("OK!"); |
39 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004235 |
Snippet name: | Java Coroutines Test! [WORKS] |
Eternal ID of this version: | #1004235/2 |
Text MD5: | f8398db82b8a6e68affa160d99571760 |
Transpilation MD5: | ad44aa32e1d05bc9aef9f18b27f1b625 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-14 12:39:53 |
Source code size: | 702 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 1525 / 1327 |
Version history: | 1 change(s) |
Referenced in: | [show references] |