if Statement


hi everyone,

i buy book me understand more advanced 2.0 concept , have quick question if statement. when use if, have use comparaison operator in parameter. why in below exemple didn’t? knows why? if use one, function don’t work properly. don’t understand why… help!

var tvpower:boolean = false;

function togglepower() {
var newchannel:number;
if (tvpower) {
changethechannel(0);
tvpower = false;
} else {
changethechannel(1);
tvpower = true;
}
}

it's shorthand boolean conditional statement.
written:

if (tvpower==true) {
changethechannel(0);
tvpower = false;
} else {
changethechannel(1);
tvpower = true;
}
}


--
-------------------------------
remove '_spamkiller_' mail
-------------------------------




More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support