What does # mean?

  1. 9 months ago

    Richard A

    22 Jan 2019 Pre-Release Testers, Xojo Pro Puerto Vallarta Mexico
    Edited 9 months ago

    What does # mean in this reference:

    #if false
         Return resJSON
    #endif

    Thanks

  2. Tim P

    22 Jan 2019 Pre-Release Testers Rochester, NY
    Edited 9 months ago

    Documentation link

  3. Richard A

    22 Jan 2019 Pre-Release Testers, Xojo Pro Puerto Vallarta Mexico

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

  4. Tim P

    22 Jan 2019 Pre-Release Testers Rochester, NY

    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

    22 Jan 2019 Pre-Release Testers, Xojo Pro, Third Party Store 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

    22 Jan 2019 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. Paul L

    23 Jan 2019 Xojo Inc, Third Party Store 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!