Conditional statement ?: returns one of two values depending on the value of the Expression1 logical expression.
Expression1 "?" Expression2 ":" Expression3
If the Expression1 expression returns True, the Expression2 expression is calculated and regarded as the result. If the Expression1 expression returns False, the Expression3 expression is calculated and regarded as the result. In all cases only one expression is calculated.
Imports System;
Imports System.Diagnostics;
Sub TestChoice();
Var
RndObj: Random = New Random();
i, j: Double;
Begin
i := RndObj.NextDouble();
j := RndObj.NextDouble();
Debug.WriteLine(i > j ? "i>j" : "i<j");
End Sub;
See also: