Forum Moderators: open

Message Too Old, No Replies

What : and? stands for?

syntax

         

mariuz

7:30 pm on Dec 1, 2003 (gmt 0)

10+ Year Member



this.n_y = n_order
? o_parent.a_children[n_order - 1].n_y
: o_parent.n_y + this.getprop('block_top');

Can anyone explain why? and : are used for in above text?

Sinner_G

7:46 pm on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, mariuz.

It is just a short form for an if/else.

In this case, it means if this.n_y is equal to n_order, then do what comes after the?, if not then do what comes after the :.

dcrombie

12:06 pm on Dec 3, 2003 (gmt 0)



var somevar = (test condition)? "true value" : "false value";