Posts

Showing posts from 2019

C# Conditional Checking

C# Conditional Checking Last Revision: 17th February 2019 Conditional checking is in every piece of programing: from simplistic to complex. In this tutorial, we'll cover if and switch statements. Note: In C# (and other languages), the equals signs has 2 types - assignment and condition. Assignment Assignment is used to assign a value to a variable (var number = 20) Conditional Conditional is used when comparing 2 or more values to each other ( tempA == tempB ) //Assignment (One = symbol) int Year = 2019; float PI = 3.142; float money = 3.50; float addUp = PI + money; //Conditional (Two = symbol) if (Year == 2019) //Is the variable "Year" equal 2019? { Console.WriteLine( "Hey, its 2019!" ); } else { Console.WriteLine( "Wooh, it isn't 2019!" ); } if (PI == money) //Is the variable "PI" is the same value as variable "money"? { Console.WriteLine( "PI is the same as money!...