Navigation
Synopsis Conditional expression for numeric values.
Syntax Exp1 ? Exp2 : Exp3
Types
Exp1 Exp2 Exp3 Exp1 ? Exp2 : Exp3
bool int int int
bool int real real
bool real real real
Description If the value of Exp is true then the value of Exp1 else the value of Exp2.
Examples
rascal>(3 > 2) ? 10 : 20
int: 10
rascal>(3 > 20) ? 10 : 20
int: 20

Questions
Question [1].
The type of (2 > 2) ? -3 : -7 is

Question [2].
The type of (18 > -8) ? -5.6800912462102760 : 16.9009388327997840 is

Question [3].
The type of (-7 > 14) ? 9 : 9.1099122424717920 is

Question [4].
(12 > 16) ? -2 : 9 == 

Question [5].
(-14 > -14) ? -6 : -10.01411730487928880 == 



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.