Use Conditional Logic with If Statements, freeCodeCamp Basic Javascript

preview_player
Показать описание
In this challenge we further explore conditional logic and conditional statements in javascript. Javascript conditionals use booleans to check wheter or not something is true or false. When a statement is true, it runs the code within the following curly braces, but if the condition is false, it skips over the code in the curly braces and keeps going. Conditionals and booleans are a powerful tool to give users choices in a program.
Рекомендации по теме
Комментарии
Автор

Fab videos Jose, most helpful!

I can't however figure out why the second return in these types of function must be placed outside of the curly brackets?

finkdifferently
Автор

Can someone tell me why my code is not working properly please? Thanks

num = int(input("Enter a number: "))
n = num % 2

if (n != 0):
print('Weird')
if (n == 0 and n == range(2, 6)):
print('Not Weird')
if (n == 0 and n == range(6, 21)):
print('Weird')
if (n > 20):
print('Not Weird')

jamelstringer