How to use the IF Statement C#
All tutorials created in C# to be posted in here.
2 posts
Page 1 of 1
Im just going to show you how to use the If statement in C#
'var' is a variable you will check against 'var2'
'var' is a variable you will check against 'var2'
Code: Select all
Its that simple...if (var == var2) // Remember TWO = chars, else you will get an error
{
//Do something
}
else
{
//Do something else
}
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

I know this tutorial is old I was looking through the tutorials to see what hasn't been posted. People should understand the difference between using = and ==.
Firstly = is an assignment operator which means you're setting one value to another.
== is the equality operator (A comparison operator) which allows you check if a value is equal to another value hence why we use the equality operator in an if statement rather than an assignment operator.
Firstly = is an assignment operator which means you're setting one value to another.
== is the equality operator (A comparison operator) which allows you check if a value is equal to another value hence why we use the equality operator in an if statement rather than an assignment operator.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023