Best way to check many variabels?
-
I'm creating a bot that checks a phone number and if a phone message matching a certain country then it will type in that language.
Heres the basic logic:
Check what number
If the number is +1
Type in englishHow would i make it easy for myself with this? My hard solution to this is to make a list of all the countries for example:
if (phonenumber) == +1
phone number is in english
if (phonenumber) == +2
phone number is in xxxThat would end up in lots of code. Is there anything i can do?
-
@rekaa0251 said in Best way to check many variabels?:
I'm creating a bot that checks a phone number and if a phone message matching a certain country then it will type in that language.
Heres the basic logic:
Check what number
If the number is +1
Type in englishHow would i make it easy for myself with this? My hard solution to this is to make a list of all the countries for example:
if (phonenumber) == +1
phone number is in english
if (phonenumber) == +2
phone number is in xxxThat would end up in lots of code. Is there anything i can do?
You can use third-party sites (there are many different)
-
@Fox I think i explained it badly.
I want to check multiple variables in one "if"
instead doing if = true
and then again if = true
I want to try making it like
if (something1) = true or (something2) trueOr use the template and put multiple variables in it and check if (template) = true
-
@rekaa0251 said in Best way to check many variabels?:
@Fox I think i explained it badly.
I want to check multiple variables in one "if"
instead doing if = true
and then again if = true
I want to try making it like
if (something1) = true or (something2) trueOr use the template and put multiple variables in it and check if (template) = true
Use a logical "OR" or a logical "AND"
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operatorstest script
-
@Fox [[ALL_MATCH_LAST_MESSAGE]].match("hi") || [[ALL_MATCH_LAST_MESSAGE]].match("love")
Can i use it like this?
-
@rekaa0251 said in Best way to check many variabels?:
@Fox [[ALL_MATCH_LAST_MESSAGE]].match("hi") || [[ALL_MATCH_LAST_MESSAGE]].match("love")
Can i use it like this?Yes, you can. It was faster to check on your own.
-
This post is deleted!
-
@Fox
It is a while loop that should check whether val1 and val2 are set to "done", in this status the while loop is simply completed. What am I doing wrong?Best regards!
-
Still need help. With values like true or false its just working fine but I need 3 values :/