✅ while loops
while loops keep repeating the same over and over without waiting for the user to respond to the anyone know how to solve this?
18 Replies
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/$ask
How to get the best help :catpog:
Make a post in #help or one of the topic channels under Development.
Avoid asking
:catthinking: Can anybody help me?
:catthinking: Has anyone used XYZ?
:catthinking: Why doesn't my code work?
C# is a big area! No one knows they can help unless you tell them about the small area you're trying to work in.
Explain what you are doing, and potentially why for as much context as possible. Avoid screenshots where possible, share code directly in Discord. Type
$code
into chat to learn how to post code.
See https://www.nohello.net and https://dontasktoask.com if you want common help chat room etiquette.tldr show your actual code
what is tldr
too long; didn't read
my code
.
well, in the while loop u never asked for user input
^
if you put in an empty name you're gonna get stuck looping forever
how do i not
i did in visual studio
the code you just sent has your
ReadLine
outside of the while loop, so you definitely didn'tcode wise i mean
and this is one of the situations where a do-while makes sense
ohh
tysm
I'd also recommend using
string.IsNullOrEmpty
or string.IsNullOrWhitespace
over someString == ""
ok
thanks
:PepoSalute: