© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
7 replies
Mathall

Why do you need to use else statements?

Sorry if this is a dumb question, I am still new but wouldn't
if(answer = true) {
Console.WriteLine("Correct!")
} else {
Console.WriteLine("Incorrect!")
}
if(answer = true) {
Console.WriteLine("Correct!")
} else {
Console.WriteLine("Incorrect!")
}

Just be exactly the same as:
if(answer = true) {
Console.WriteLine("Correct!")
} 
Console.WriteLine("Incorrect!")
if(answer = true) {
Console.WriteLine("Correct!")
} 
Console.WriteLine("Incorrect!")
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

when to use switches and when to use if statements?
C#CC# / help
2y ago
❔ Why do I not need to do "using System" ?
C#CC# / help
4y ago
✅ (Why) should you use SpaServices.Extensions?
C#CC# / help
3y ago
how do you use Color.fromArgb
C#CC# / help
2y ago