Press enter only
I want to code a loop which only takes spacebar for the code to loop.
E.g.
While (true)
{
Console.ReadKey(" ")
loop...
}
However, this isint working.
12 Replies
Console.KeyAvailable Property (System)
Gets a value indicating whether a key press is available in the input stream.
That code won't compile, did you look at the documentation for ReadKey?
You want something like:
huh let me try that rq
you my friend r a genius
i have one question tho
the code now inputs a space before every 'dice' and it wasnt doing that before
anything i did? @mtreit
or what could i change if i wanted it to be enter instead
nevermind im being stupid about the spaceing before the dice lol
If you want to check for the Enter key being pressed you can do:
sweet stuff man ty so much
@Kapa._ BTW you might want to pass
true
to Console.ReadKey. That will prevent the keypresses from being printed to the screen.you are brilliant, ty so much man
$close
Use the /close command to mark a forum thread as answered