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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

var myVar = boolean1 ¦¦ false;

Status
Not open for further replies.

heleneb

Programmer
Joined
Oct 16, 2002
Messages
2
Location
CH
What does the following is suppose to do?

var myVar = boolean1 || false;

Thanks
 
Heaven only knows what it was intended to do by the coder.

boolean1 must be the name of a variable. It must be assigned a value before it can be used in that statement. The name suggests that it will have a value of true or false.

Piece by piece

"var myVar" declares the name of a variable.

"var myVar =" assigns the value on the right side of the = to the variable.

The expression on the right side is evaluated from left to right

"boolean1" is true or false

"||" means combine boolean1 with false using logical OR.

"true OR false" evaluates to true.

So myVar gets the value true.


May I ask a question?

How was it that you came to ask this question?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top