Sign in to follow this  
taguilo

When to close multiple IF statements with an els

Recommended Posts

I have always found that closing multiple IF statements prior to an els has worked, till today.This works (sort of) wherein everything after the first IF works, but the basic argument of (A:SIM ON GROUND,bool) 0 == refuses to co-operate : (A:SIM ON GROUND,bool) 0 == if{ (A:general eng propeller lever position:2,percent) 80 < (A:ENG1 COMBUSTION,bool) 0 == || (L:CorrectedN1,enum) 57 <= || if{ 1 (>L:autorotate,bool) } els{ 0 (>L:autorotate,bool) } } This works with the basic argument of (A:SIM ON GROUND,bool) 0 == where is resets when sim on ground, but the statements after the if do not work: (A:SIM ON GROUND,bool) 0 == if{ (A:general eng propeller lever position:2,percent) 80 < (A:ENG1 COMBUSTION,bool) 0 == || (L:CorrectedN1,enum) 57 <= || if{ 1 (>L:autorotate,bool) } } els{ 0 (>L:autorotate,bool) } So the question is, when is it required to close an IF statement, an els statement or a combination of both??Steve

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

""So the question is, when is it required to close an IFstatement, an els statement or a combination of both??""XML nest structuring of "if/els" kinda follow the rules of most programming languages. Each "if{" should have its finishing "}" and the same applies for "els{"I see in the second paragraph, there is a "}" missing here:....(>L:autorotate,bool) } ...which is strange because it does exists in the first.(?)In this case, the entire portion after the first "if{" will execute as long as SIM ON GROUND is 0: (A:SIM ON GROUND,bool) 0 == if{ (A:general eng propeller lever position:2,percent) 80 < (A:ENG1 COMBUSTION,bool) 0 == || (L:CorrectedN1,enum) 57 <= || if{ 1 (>L:autorotate,bool) } els{ 0 (>L:autorotate,bool) } }Or you might save the nested if/els using bool conditionals:(A:SIM ON GROUND,bool)if{ (A:general eng propeller lever position:2,percent) 80 < (A:ENG1 COMBUSTION,bool) ! || (L:CorrectedN1,enum) 57 <= || (>L:autorotate,bool) }(Note: remember "ampersand"; should be used instead of "<")Hope this helps a bit.Tom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this