Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Introduction
Most programmers probably already know this, but for beginner programmers, it is quite frequently unknown or overlooked.
When you evaluate expressions you need not evaluate "If <expression> = true then", you simply evaluate "If <expression> then"
This is because <expression> already produces a Boolean value, and an if then branch breaks down to the following logic:
1.If <Expression> then
2. 'True was the case
3.Else
4. 'False was the case
5.End If
So when you evaluate the following expression for example:
(1+2 = 4)
This will automatically become false, because 1+2 does not equal 4.
True will always = true (It is what it is!)
False will always = false(It is what it is!)
Which means that saying:
1.If (1+2=4) = true then
2. 'True was the case
3.Else
4. 'False was the case
5.End If
is effectively saying the same as saying
1.If <Boolean> = true then
2.2. 'True was the case
3.3.Else
4.4. 'False was the case
5.5.End If
But since a Boolean "is what is", we need not check if "<Boolean>" = true...
So the following is the same as above:
1.If <Boolean> then
2. 'True was the case
3.Else
4. 'False was the case
5.End If
And the following is just as absurd as evaluating true in an expression:
1.If (((((1 + 2) = 3) = True) = True) = True) Then
2. 'True was the case
3.Else
4. 'False was the case
5.End If
In conclusion, try to remember, "It is what it is."
References
- MSDN Library http://msdn.microsoft.com/en-us/
- MSDN Forums http://social.msdn.microsoft.com/Forums/en-US/categories