Android Question If with 3 or's

appie21

Active Member
Licensed User
Longtime User
Hello

i have a program that mus do a thing when 3 things are true

so I wrote

If EditLampInfo.Text.Contains("9") == vrresuilt.Contains("my ") == vrresuilt.Contains("hello") Then
log("ökay")

End If

I get the eeroor

Word =

What is wrong with this?
 

JordiCP

Expert
Licensed User
Longtime User
I have never seen "==" as a logical OR. Perhaps you were looking for the logical C/Java-style "OR" , which is "||" ?
Should be
B4X:
If EditLampInfo.Text.Contains("9") OR vrresuilt.Contains("my ") OR vrresuilt.Contains("hello") Then
  log("ökay")
End If
 
Upvote 0

fixit30

Active Member
Licensed User
Longtime User
If EditLampInfo.Text.Contains("9") OR vrresuilt.Contains("my ") OR vrresuilt.Contains("hello") Then
log("ökay")
End If

This will return True if only one is matched not all three as per the OP request.

Maybe it should be

B4X:
If EditLampInfo.Text.Contains("9") AND vrresuilt.Contains("my ") And vrresuilt.Contains("hello") Then
  log("ökay")
End If
 
Upvote 0
Top