public object visitTernaryExpr(Expr.Ternary expr) { Resolve(expr.condition); Resolve(expr.conditionTrueValue); Resolve(expr.conditionFalseValue); return(null); }
public object visitTernaryExpr(Expr.Ternary expr) { object conditionExpr = Evaluate(expr.condition); bool condition = GetTruthValue(conditionExpr); return(condition ? Evaluate(expr.conditionTrueValue) : Evaluate(expr.conditionFalseValue)); }
public string visitTernaryExpr(Expr.Ternary expr) { return(parenthesize("IF" + expr.condition.accept(this)) + " THEN " + expr.conditionTrueValue.accept(this) + " ELSE " + expr.conditionFalseValue.accept(this)); }