In this vastly simplified example, I ran into a problem where a simple multi-line boolean test provided to an If…Then always generated a syntax error:
Public Function testForCURLError(theErrorNumber as Int64) As Boolean
Var wasAnError As Boolean = FALSE
If (theErrorNumber = 108 or
theErrorNumber = 107) Then
wasAnError = true
End If
return wasAnError
End Function
Of course, once I combined the two tests separated by the “or” onto ONE line, it compiles fine.
But I don’t just have two tests. I have a half dozen. And they aren’t as simple as comparing against an integer literal.
Public Function testForCURLError(theErrorNumber As Int64) As Boolean
Var wasAnError As Boolean = False
If (theErrorNumber = 108 Or _
theErrorNumber = 107) Then
wasAnError = True
End If
Return wasAnError
End Function
Fair enough. However, the If…Then…Else documentation doesn’t explicitly say you can’t continue the statement onto a second (or nth) line. Nowadays, that’s unusual syntax for a modern language. A simple NOTE might have saved me a couple hours.
Additionally, I think the Xojo compiler’s syntax parser could give more meaningful error messages. While it’s always “user error”, I chased my tail for hours on a vanilla syntax error due to an errant semicolon at the end of a line from C++ code I had pasted in.