 |
Author |
Topic: Question Mark "?" couldn?t find it in the refernce (Read 337 times) |
|
stylefetish
|
Question Mark "?" couldn?t find it in the refernce
« on: Jun 21st, 2004, 10:59am » |
|
but came across it quiet some times. what is it for? how to use it? Thanks in advance!
|
« Last Edit: Jun 21st, 2004, 10:59am by stylefetish » |
|
|
|
|
Koenie
 

|
Re: Question Mark "?" couldn?t find it in the refe
« Reply #1 on: Jun 21st, 2004, 11:08am » |
|
People call it the trinary operator, and it works as a shortcut if-else statement. It basically works like this: Code:(expression) ? statement1 : statement2; |
| If expression is true, statement1 will happen and else statement2 will happen. Here is an example: Code:String b = (c != 5) ? "c isn't five!" : "c is five!"; |
| Hope this helps! Koenie
|
http://koeniedesign.com
|
|
|
stylefetish
|
Re: Question Mark "?" couldn?t find it in the refe
« Reply #2 on: Jun 21st, 2004, 11:37am » |
|
exelent! This helps a lot and is exactly what I needed :-D
|
|
|
|
kevinP

|
Re: Question Mark "?" couldn?t find it in the refe
« Reply #3 on: Jun 21st, 2004, 11:18pm » |
|
on Jun 21st, 2004, 11:08am, Koenie wrote:People call it the trinary operator... |
| But more people call it the ternary operator.
|
Kevin Pfeiffer
|
|
|
|