Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax help ? for mulitlines of if condition

Status
Not open for further replies.

TWillard

Programmer
Apr 26, 2001
263
US
I have an if condition that is going to check the flags of several variables. In the spirit of clean code and readability, I would like to have this statement on multiple lines in my file. How would I do this?

I know in VBScript I can use the & _ opperator. In Java I would simple use the next line and be sure I had the correct open and close parenthesis? Can this be done in JavaScript?

if ( ( flg_1 = 'TRUE' ) ||
( flg_2 = 'TRUE' ) ||
( flg_3 = 'TRUE' ) ||
( flg_4 = 'FALSE' ) ||
( flg_5 = 'FALSE' ) ||
( flg_6 = 'FALSE' )
)
{
//do logic here
}

 
Thanks misery347, It does indeed work! If you will take a closer look at my code however, you will notice that I am using '=' for comparison as opposed to '=='. This caused me quite a headache!!!
 
lol
I'm sorry I should have seen that. I just looked at the parenthesis to make sure everything matched I didn't even check the conditions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top