Read integer from console and sleep

Iain staffell at gmail.com
Fri May 4 10:51:14 PDT 2012


>
> If you want Iain I'll put this version by Ali Çehreli in 
> Rosettacode:
>
> import std.stdio, core.thread;
>
> void main() {
>     write("Enter a time to sleep (in seconds): ");
>
>     long secs;
>     readf(" %d", &secs);
>
>     writeln("Sleeping...");
>     Thread.sleep(dur!"seconds"(secs));
>     writeln("Awake!");
> }
>
>
> Bye,
> bearophile

That's great, and thanks to Ali for explaining.

Out of interest, is there a coordinated effort to update things 
like Rosetta or the dsource.org tutorials to use D2.0?  I find 
one of the big stumbling blocks to learning is that half of the 
tutorials and code snippets out there are obsolete!



More information about the Digitalmars-d-learn mailing list