iOS Question Can compiler directives like #IF RELEASE ... #ELSE ... #END IF be used anywhere?

Andris

Active Member
Licensed User
Longtime User
This is a simple question but I want to make sure I'm right in using directives anywhere I want in my code. Can I use an #IF RELEASE block absolutely anywhere in my code? Here's a particular example:
B4X:
    #IF RELEASE
    If iAppStore.CanMakePayments = False Then        'Apple billing service
    #ELSE
    If iAppStore_CanMakePayments = False Then        'simulation of Apple billing for Debug compilation
    #END IF          
       
        '...
        'code
        '...
   
    End If

To summarize, I'm using #IF RELEASE to specify one of two different "If ..... " lines. Is this OK or is it frowned upon?
 

Semen Matusovskiy

Well-Known Member
Licensed User
IMO, B4X conditional compilation is absolutelly the same as in other languages. Preprocessor removes unused parts and compiler compiles the rest.
So you can insert #IF ... #ELSE ... #END IF anywhere.
 
Upvote 0
Top