say you have something like:
int num = 0
then you do
if(num > 5 || num < 4)
{
...
}
it checks both, but what if you do
if(num < 4 || num > 5)
{
...
}
does it only check the 1st statement?
same as:
if(num > 5 && num == 0)
{
...
}
it should stop after failing the 1st and… right?
This is called boolean short-circuit evaluation and (although
[citation-needed]) yes, C# and VB.NET have it (thanks @Lasse for the correction).In C#,
||and&&are the short-circuited versions of|and&, respectively.