Created
December 2, 2016 02:36
-
-
Save jooyunghan/aeb61f43c03b3c90c4eae3d7118ee10b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fibo2() { | |
| var a, b; // local vars | |
| return wrap(function (c) { | |
| while (1) { | |
| switch (c.next) { | |
| case 0: | |
| a=0, b=1; | |
| case 1: // while begin | |
| if (!true) { // while cond | |
| c.next = 3; | |
| break; | |
| } | |
| // while body ben | |
| // yield a | |
| c.next = 2; | |
| return a; | |
| case 2: | |
| b = a + b; | |
| a = b - a; | |
| // while body end | |
| c.next = 1; | |
| break; | |
| case 3: | |
| // while end | |
| case "end": | |
| return c.stop(); | |
| } | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment