Code Example

def async randPrintNums(n):
    def tasks = []
    for(var i in 0..n)
        tasks.push async :>
            wait sleep (100 * Math.random())
            trace index
        where index = i
    wait join tasks
randPrintNums 100


在 2012年4月26日星期四UTC+8下午8时26分20秒,Belleve Invis写道:
>
> I've made it for years. Mostly inspired by Python and Haskell.
>
> Doc:
> http://be5invis.github.com/moescript/
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to