Hello, CBool Operator does not exist in Xojo, is there an equivalent operator to convert this code ?
Dim Char As String
If CBool(Sgn(dd) - 1) And Lat Then
Char = "S"
ElseIf CBool(Sgn(dd) - 1) Then
Char = "E"
ElseIf Lat Then
Char = "N"
Else
Char = "W"
End If
If if(Sgn(dd) - 1=0,false,true) And Lat Then
Char = “S”
ElseIf if(Sgn(dd) - 1=0,false,true) Then
Char = “E”
ElseIf Lat Then
Char = “N”
Else
Char = “W”
End If[/code]
Dim Char As String
If ((Sgn(dd) - 1)<>0) And Lat Then
Char = "S"
ElseIf ((Sgn(dd) - 1)<>0) Then
Char = "E"
ElseIf Lat Then
Char = "N"
Else
Char = "W"
End If
I’ve been told that variants are exceptionally slow. I’ve not confirmed that, but various engineers have said that over the years. Be a good experiment when I have spare time.
the overhead of variant is not that big that you should worry.
Of course if you start using variant everywhere instead of integers for example, your performance will suffer.
On a variant, for each value assignment, an object is created. For every access, there may be a conversion needed which can also hurt on performance.
Dim Char As String
If ((Sgn(dd) - 1)<>0) And Lat Then
Char = "S"
ElseIf ((Sgn(dd) - 1)<>0) Then
Char = "E"
ElseIf Lat Then
Char = "N"
Else
Char = "W"
End If