Question about if conditional statements

Question about if conditional statements
0.0 0


Hello, im wondering if “return false” has to always be outside of if’s curly brackets or it doesnt matter? Does “true” need to be inside of curly brackets of if statment and false outside of it? Or it doesnt matter?


The stuff inside the curly braces will only execute if the condition is satisfied


So since if is used only if statement is true then true goes inside of its curly brackets? Ok i got it now


The function itself has a set of curly braces, and then each if statement has it’s own set of curly braces that contain the code that executes IF the condition is true.
If the condition is not true, the function simply skips whatever code is within the if statement and instead executes the code that is not part of the if statement (but is part of the function, since it is within the function’s curly braces), which in this case is:
return “No, that was false”;