10-30-2023, 10:45 PM
Could you clarify what you're trying to achieve? You don't need C to write that function, the ternary operator is the same as just using an `if` for your usage:
Unfortunately if you want a "real" ternary operator you can't implement that as a function. The ternary operator is only supposed to evaluate one of the true or false paths, not both, but there's no way to achieve that with a function call.
Code: (Select All)
Function tenaerOp&(e As long, x As Long)
If x > e Then
tenaerOp& = 100
else
tenaerOp& = 200
End If
End Function
Unfortunately if you want a "real" ternary operator you can't implement that as a function. The ternary operator is only supposed to evaluate one of the true or false paths, not both, but there's no way to achieve that with a function call.