Can i add more than one condition ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can i add more than one condition ??

In if statement how can i add multiple conditions at the same time

2nd Apr 2019, 6:36 PM
Let Name = Abdulrahman;
5 Answers
+ 6
You Can practise as follows: Suppose you're going to write true, if the variable x is greater than 5 and the variable y is equal to 10; To do this you can save the conditions in separate variables: var a = x > 5; var b = y == 10; and to execute a code if its true: if(a && b) { your code }
2nd Apr 2019, 6:51 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 4
Using logic: if (x && y) {} (x and y) or if (x || y) {} (x or y) Among others!
2nd Apr 2019, 6:40 PM
Nathan Lewis
Nathan Lewis - avatar
+ 4
Abdalrhman ⚡ It Can and cannot be, depends on how you use it
3rd Apr 2019, 2:05 AM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 2
2nd Apr 2019, 6:50 PM
Let Name = Abdulrahman;
+ 2
const InvBoy = me; But in this situation a & b is not variables .. am i right ?
3rd Apr 2019, 1:28 AM
Let Name = Abdulrahman;