Home > DeveloperSection > Forums > Multiple Conditions in If Statement or Splitting using C#
F Scott Fitzgerald
F Scott Fitzgerald

Total Post:29

Points:203
Posted on    October-14-2013 7:25 AM

 C# C# 
Ratings:


 1 Reply(s)
 912  View(s)
Rate this:

when i am using if statements with multiple conditions, how are they managed in the compiler?

A) Will it ignore the second Statement, if the first statement is not fulfilled or vice versa?

If(time > 3.0 && hitEnabled)

B) Late Defintions are often recommended, so should i prefere to use one condition in if statements?

if(time > 3.0)
    if(hitEnabled)

Thanks!



Babe Zaharias
Babe Zaharias

Total Post:19

Points:133
Posted on    October-14-2013 7:49 AM

String someString = null;
 
        if (someString != null && someString[4].Equals('a'))
        {
            //// not called
        }
 
        if (someString != null || someString[4].Equals('a'))
        {
            //// exception
        }
 
        Console.ReadLine();

Don't want to miss updates? Please click the below button!

Follow MindStick