What does # mean?

  1. 5 weeks ago

    Richard A

    Jan 22 Pre-Release Testers, Xojo Pro
    Edited 5 weeks ago

    What does # mean in this reference:

    #if false
         Return resJSON
    #endif

    Thanks

  2. Tim P

    Jan 22 Pre-Release Testers feedback://46303
    Edited 5 weeks ago

    Documentation link

  3. Richard A

    Jan 22 Pre-Release Testers, Xojo Pro

    Thanks Tim, Though I still can't figure out what this block means?

  4. Tim P

    Jan 22 Pre-Release Testers feedback://46303

    It means the compiler won't compile the code in the statement because it doesn't evaluate to true.
    It's sort of like commenting out, but tricks the IDE into formatting the code for display.

  5. Bob K

    Jan 22 Pre-Release Testers, Xojo Pro Kansas City

    Conditional compilation. It is typically used with targets but it can also be conveniently used to comment out blocks of code by simply using false. We use sometimes to segregate code that's for the Mac App Store vs normal web release.

    Typical usage:

    #if targetWindows 
      //Do Windows stuff here
    #elseif TargetMacOS
      //Do MacOS stuff here
    #else
      //Linux?
    #endif
  6. Joost R

    Jan 22 Pre-Release Testers, Xojo Pro The Netherlands

    You could use any constant for conditional compilation:

    #If cMycondition = "a" Then
      // Code providing features related to value "a"
    #ElseIF
     // Code providing more general features 
    #Endif
  7. 4 weeks ago

    Paul L

    Jan 23 Xojo Inc http://docs.xojo.com

    @RichardAlbrecht Thanks Tim, Though I still can't figure out what this block means?

    More information:

    https://docs.xojo.com/UserGuide:Conditional_Compilation

or Sign Up to reply!