开发者

ActionScript ternary operator

开发者 https://www.devze.com 2023-01-05 20:16 出处:网络
in action script str is string var str=(some condition)?\" store true\":\"store false\"; when i alert the 开发者_如何学Gostr am not getting any message .....why am not getting

in action script

str is string var

str=(some condition)?" store true":"store false";

when i alert the 开发者_如何学Gostr am not getting any message .....why am not getting

code:

[Bindable]
public var errVarMsg:String ;

errVarMsg="";
errVarMsg=(minfee<=maxfee)?"":"fee min > max\n";
Alert.show(errVarMsg);


If minfee is less than or equal to maxfee, you'll get an empty alert which might be taken as no message. Change it to

minfee = 5;
maxfee = 10;
errVarMsg = (minfee <= maxfee) ? "min <= max" : "min > max";
Alert.show(errVarMsg);

minfee = 15;
maxfee = 10;
errVarMsg = (minfee <= maxfee) ? "min <= max" : "min > max";
Alert.show(errVarMsg);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号