If, Then statements

Im doing an actionscripting book, and I’m learning how to use functions. But anyways, in this script i created a function that when you click the power button the TV will turn on and off. On the first frame of the actions layer within the function, there is an if then statement that confuses me. It says:

tvPower = false;
function togglePower(){
if(tvPower) {
newChannel = 0;
tvPower = false;

my question is, Arent you supposed to name a condition in the parenthesis, for example
if(x>5){
Do something;
}
I dont understand how tvPower is a condition.

[AS]if(tvPower) // checks if tvPower is true. True means different than 0, not null or a non empty string.[/AS]

tvPower alone as claudio says checks if tvPower is set to true.

<B>!</B>tvPower would check if the variable tvPower were false, null, or undefined.

Thanks a lot, I feel kinda stupid now, but that was very helpful. It is all so clear to me now.

You’re welcome :thumb: