-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When to use flush() and resetInput() #27
Comments
Hi, flush() function writes to output channel all characters that could have been buffered until that moment. resetInput() acts as "reset keyboard buffer" (so it's related to input channel), it's useful before getting an input from keyboard, with readKey or readLine() Hope it helps! |
It does help. What are the potential consequences of not using either? I've realized in my code I am using (or rather not using) these haphazardly and without any thought or understanding. Everything seems to be behaving fine but I'm guessing there is some nuance there depending on my connection quality and terminal client. |
It depends on the client used. For example, if I don't user flush(), sometimes using SyncTerm some characters are "retained" till some other char comes. |
OK got it, thanks! |
I've been trying to understand when these need to be used and what they do but I don't follow it.
Could you give me some guidance on when to use either of these and why. Thanks!
The text was updated successfully, but these errors were encountered: