Saturday, September 6, 2014

C# single or double equal signs

As a fun added bonus above ^, here's how C# got its name!

A single equal sign (=) is interpreted as "is."
You can set a value such as x = 10. It is a way to assign a value. Do not use this inside of an if statement.

A double equal sign (==) is interpreted as "is equal to."
This is the literal equivalent of a variable. We are not assigning, but for example, checking if x == 10 (is the value of x actually 10). It would be written as:

if (x == 10) {

There are no triple equal signs (===) in C#, this is part of JavaScript.