Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ternary operator
#2
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:

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.
Reply


Messages In This Thread
Ternary operator - by Kernelpanic - 10-30-2023, 09:57 PM
RE: Ternary operator - by DSMan195276 - 10-30-2023, 10:45 PM
RE: Ternary operator - by bplus - 10-30-2023, 11:08 PM
RE: Ternary operator - by Kernelpanic - 10-30-2023, 11:50 PM
RE: Ternary operator - by DSMan195276 - 10-31-2023, 01:13 AM
RE: Ternary operator - by Kernelpanic - 10-31-2023, 03:36 PM
RE: Ternary operator - by bplus - 10-31-2023, 01:37 AM
RE: Ternary operator - by DSMan195276 - 10-31-2023, 01:49 AM
RE: Ternary operator - by bplus - 10-31-2023, 02:02 AM



Users browsing this thread: 2 Guest(s)