function get( num){
var a = num
//var a = new Array(3);
for (var i = 0; i <= 50; i++) {
//a.push(i);
if (a <= 40) {
return "Yes its less than 40" ;
}
else {
return "No its more than 40" ;
}
}
}
console.log(get(41));
if(<Condition>)
{
<statement>
}
# Q: CAN WE USE A FOR LOOP INSIDE AN IF STATEMENT
# A: YES, YOU CAN PUT A FOR LOOP INSIDE AN IF STATEMENT. LIKE THIS:
myVar = 5
if myVar == 5:
for i in range(myVar): # Prints out 01234 on separate lines
print(i)
# You could also put an if statement in a for loop:
myNumber = 10
for i in range(myNumber):
if i == 4:
print("i is equal to 4")
squares = [i**2 for i in range(10) if i%2==0]