Yep, you got it, basically. Except that your code should maybe look like this...
...so you wouldn't be declaring a new variable y when you assign the value.
That compact bit of code is called a ternary operator. Here's an excerpt of what wikipedia's entry on it says:
...the ?: operator is used as a shorthand replacement for the if-then-else conditional statement; the general form is condition ? op1 : op2. If condition is true, the statement evaluates as op1; otherwise, it evaluates as op2.
The understandability/readability of the ternary operator has been the subject of a few discussions here, I'll try to dig one up...
Joined: Jan 19, 2001
Wow, you're quick Katrina! And I like your example way better than the one from wikipedia.
Here's a couple previous conversations about the ternary operator, interesting reading: