How to conditionally use `XojoVersionString`

I’m testing some new features in the latest beta for an open source module and I want to be able to offer them for users of that latest version of Xojo but fall back to a different method for older versions.

I see that there is a XojoVersionString method that returns the current version of Xojo (in this case, it’s "2024r2"). I could do this:

#If XojoVersion = "2024r2" Then
  // Do something
#EndIf

How do I detect if the version is >= that 2024r2 when a string is provided?

XojoVersion is a Double and XojoVersionString is a String. Compare against XojoVersion or you could (not recommended) parse XojoVersionString.

#If XojoVersion > 2024.01 Then
  // Do something
#EndIf

To use XojoVersionString, your example is correct, you’d just need to do it for each version and without conditional compilation. Whereas you can just check > 2024.01, for example, with XojoVersion.

2 Likes

Perfect - thank you.