Hello C# learners and programmers
Depending on your query here... please pay attention on the page no. 47, and in the table provide observe carefully the second row on -(subtraction operator)
Operator is:
category: Binary
Eg Expression:
Result:
var1 is assigned the value that is the value of var3 subtracted from the value of var2.
Example:
if we want to subtract 5(firstNumber) from 10(secondNumber) then the code below is invalid
Code:
Console.WriteLine("The result of subtracting {0} from {1} is: {2}.", firstNumber, secondNumber, firstNumber - secondNumber);
Execution of above code gives annoying result
Code:
The result of subtracting 5 from 10 is: -5
Hence the code below is perfectly valid
Code:
Console.WriteLine("The result of subtracting {0} from {1} is: {2}.", firstNumber, secondNumber, secondNumber - firstNumber);
Cheers!!!
Regards C# expert
SparkSoft®