Asynchronous code (equivalent to javascript setTimeout) in Nim

What will be the nim equivalent of this javascript program using setTimeout? Please do not crack the dream (1000) and keep the code asynchronous.

setTimeout(
    function()
    {
        console.log("Hello world")
    },
    1000
)
+4
source share
1 answer

The asyncdispatch module defines a function sleepAsync: https://nim-lang.org/docs/asyncdispatch.html#sleepAsync,int

You can use this to create an equivalent setTimeout.

+5
source

Source: https://habr.com/ru/post/1684984/


All Articles