C
C#•4w ago
Mathall

Why do you need to use else statements?

Sorry if this is a dumb question, I am still new but wouldn't
C#
if(answer = true) {
Console.WriteLine("Correct!")
} else {
Console.WriteLine("Incorrect!")
}
C#
if(answer = true) {
Console.WriteLine("Correct!")
} else {
Console.WriteLine("Incorrect!")
}
Just be exactly the same as:
C#
if(answer = true) {
Console.WriteLine("Correct!")
}
Console.WriteLine("Incorrect!")
C#
if(answer = true) {
Console.WriteLine("Correct!")
}
Console.WriteLine("Incorrect!")
5 Replies
SG97
SG97•4w ago
have you tried to run the code? = assignment btw if you run it, you'll find out why 🙂
seito.
seito.•4w ago
= you're putting a value == its to get
Jimmacle
Jimmacle•4w ago
$tias
Jimmacle
Jimmacle•4w ago
remember code runs from the top down and keeps going until it hits a return or the end of the method
Want results from more Discord servers?
Add your server
More Posts