Wish [B4X] Multiple Conditional Symbols

hatzisn

Expert
Licensed User
Longtime User
Some times it is needed to use multiple Conditional Symbols. For example if you have two conditional Symbols (lets say PaidNoAds and WithAds) and you have to add SimpleMediaManager which requires its own Conditional Symbols according to what you will use it for. Then what do you do? You have to use the coditional symbols of SMM and also in the same time one of the above. If you do this then the execution passes from both IFs if you choose SMM_ZOOM:

B4X:
#if PayNoAds OR SMM_ZOOM
    'DO SOMETHING
#end if

#if WithAds OR SMM_ZOOM
    'DO SOMETHING
#end if

I know that it is possible to replace conditional symbols with variables checking to know which condition is valid but I still think it is a nice thing to have.
 

aeric

Expert
Licensed User
Longtime User
If I understand correctly.



B4X:
#if PayNoAds
    LoadPremiumFeature
#end if

#if WithAds
    LoadLimitedFeature
#end if

#if SMM_ZOOM
    EnableSmmZoom
#End If

Optionally, there is a "Default" configuration with empty Conditional Symbols where all the 3 scenarios will not be met.
 

hatzisn

Expert
Licensed User
Longtime User
Thanks, I was not aware that you can choose more than one conditional symbols in a configuration. I will try it a.s.a.p.
 

hatzisn

Expert
Licensed User
Longtime User
Thank you @aeric. It worked.
 

Cableguy

Expert
Licensed User
Longtime User
Thanks, I was not aware that you can choose more than one conditional symbols in a configuration. I will try it a.s.a.p.
You can't choose more than one... you can however define miltiple conditional symbols, and compile using one particular symbol, like the example given by Aeric... during compilation, all code marked with a conditionnal symbol other than the chosen one will be ignored
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…