if- else statements are conditional statements or in another way you can make decisions based on these statements that which part of the code you will execute when your condition is true and which block of code you will execute when your condition is false. Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed if the same condition is false. Use else if to specify a new condition to test, if the first condition is false. Use switch to select one of many blocks of code to be executed
Example
a=10
b=5
if a>b:
print(“a is greater”)
else: print(“b is greater”)
IsNaN is used to test if something is a number or not. It will return true if whatever is passed. Otherwise it returns false.
- log(isNaN(10)); // returns “false”
- log(isNaN(’10’)); // still returns “false”
- log(isNaN(‘sample’)); // returns “true”
Hi Ivan! Your explanation of isNan was great and your example gave me a better understanding! When coding it is important to understand if user inputs are valid numbers. I also, think your example of conditional statements for true or false statements explains why code blocks are executed or not.