Yep -- it should, and this isn't a bug with SLEEP.
(And I can hear it now -- "What the flock?! Has Steve finally went crazy??!")
Nope. I haven't.
I imagine your program looked something similar to the following:
At which point, your program can now compile, freeze up, and do absolutely nothing for you...
"And how is this not a bug with SLEEP??" (I can hear the confused shout all the way here at my house already!)
It's because you haven't set the _SOURCE to your program yet.I'd like to have $CONSOLE:ONLY automatically default to a _DEST _CONSOLE: _SOURCE _CONSOLE, but I haven't sorted out how the heck to have QB64 do that for us yet -- which is why you need that _DEST _CONSOLE to print to the console. By the same token, you need a _SOURCE _CONSOLE to read input from that console...
Without _SOURCE _CONSOLE, your program ends up waiting for a keypress from the non-existent main program window -- and thus it just sits there and does nothing, as the above program so aptly demonstrates.
Try this code instead:
Viola! It works as it should. ;)
Since $CONSOLE can be used
with a main program window, you need to set the _SOURCE for where you're getting input from. (Which oddly enough, you
don't have to do with INPUT, as it somehow works with _DEST and not _SOURCE, as you'd expect. Perhaps because it can also print to the screen??)
Isn't programming lovely with how inconsistent syntax reacts? SLEEP reads input based on the _SOURCE... INPUT reads input based on the _DEST... And it all just leads to folks scratching their heads and saying, "What the flock??! Now I see why poor Steve is as crazy as he is!"...
Anywho, that should address the issue -- unless I'm talking out my rear again and completely missed the problem. If it still doesn't work as you'd expect, with the _SOURCE set, post me some code and explain the issue to me again in a little better detail, and I'll dig into whatever the heck it is I've overlooked again.
(Another possible issue to keep in mind is: Many of the console commands are Windows-only, as I don't have a Linux/Mac rig dedicated to test things, so I only pushed the changes to the windows side of things. If you're running under Linux/Mac, I doubt SLEEP will work for you, no matter what you try.)