Click to See Complete Forum and Search --> : What is this doing?
Help
Feb 20th, 2001, 03:39 PM
What does this code do?
Im lost on the ? and : signs?
return(num1>num2 ? num1 : num2);
parksie
Feb 20th, 2001, 03:46 PM
The ?: operator is merely shorthand:
string x;
int y = 4
x = ((y > 4) ? "Y greater than 4" : "Y not greater than 4");
Here's the syntax:
result = (comparison) ? true-result : false-result
Vlatko
Feb 20th, 2001, 03:48 PM
If num1>num2 then num1 is returned else if num1<num2 then num2 is returned.
That means thet if the expression is true the first value is returned else the second is retuned.
Vlatko
Feb 20th, 2001, 03:50 PM
Little late...
parksie
Feb 20th, 2001, 03:52 PM
Hehe n/p ;)
<<< burns back from holiday to answer questions :p
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.