I need to check the value of all 3 variables(username, password, secret). If a value is NA then I need to execute a print statement or else some condition needs to be executed.
JavaScript
x
12
12
1
Example 1:
2
3
username = person1
4
password = pass1
5
secret = NA
6
7
Example 2:
8
9
username = person1
10
password = pass1
11
secret = secret1
12
Example
JavaScript
1
7
1
#value = Check all 3 variables for NA value
2
if value is NA:
3
print("NA Block")
4
else:
5
print("Value Block")
6
#Calling some function
7
How to check the value of those variables all at once?
Advertisement
Answer
You could use the in
operator to check whether a value is "NA"
. Like so:
JavaScript
1
6
1
if "NA" in (username, password, secret):
2
print("NA Block")
3
else:
4
print("Value Block")
5
#Calling some function
6