+ 1
Can I have multiple conditions in the if statement
How many conditions can I have in the if statement
9 Respostas
+ 7
Yes using ( && or || ) And Or OR operator.
Here's an example:
if (n > 10 && n < 15 ) {
// Do something
}
Here we have 2 conditions inside if statment, U can have infinite number of condition using AND or OR operator.
+ 5
You can have multiple conditions in your if statement by combining it with any logical operator like and or not . For example:
age = input()
if(age >= 18 && age > 0 ||age <= 40 ){
print("Allowed")
In this example there are total 3 conditions given in the if statement.
+ 4
As many as you want
+ 3
You have recently asked a very similar question in a thread that you have deleted.
You can chain conditions with logical operators and you can chain and nest if-else-statements. You can have as many as you want.
If you have a particular issue with a code, please link your code and describe what it is supposed to do.
+ 2
Look up ternary you want to be more precise with your conditions.
+ 1
You can use as much as you want..... by using &&(AND) operator and ||(OR) Operator for two or more conditions in same if statement
+ 1
You can have as many condition as u want.
Eg:-
if(a>0 && a<50)
{
printf("Hello");
}
0
Lisa, I tried to find that question to find the way to code it, but I must have accidentally deleted it, as I could not find it
0
Use iff for double condition