B4J Question [BANano] [Solved] How to write this the BANAnoWay?

alwaysbusy

Expert
Licensed User
Longtime User
Very hard to answer without any context, but this is what it actually does (it does what we call in Javascript a 'double bang' and an OR):

B4X:
Sub CheckPassword(v As Object) As Object
     Return Not(Not(v)) Or "Password is required"
End Sub

...
Log(CheckPassword("")) ' Password is required
Log(CheckPassword(True)) 'true
Log(CheckPassword(False)) ' Password is required
Log(CheckPassword("Password")) ' true
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…