C
C#•6mo 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•6mo ago
have you tried to run the code? = assignment btw if you run it, you'll find out why 🙂
vitukjkkk
vitukjkkk•6mo ago
= you're putting a value == its to get
Jimmacle
Jimmacle•6mo ago
$tias
Jimmacle
Jimmacle•6mo 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