I am working on a question for my Computer Programming class in high school and the question is as follows.
Using a conditional statement, generate a program in any coding language and explain the working of it: “If the temperature of your room is more than 80° or less than or equal to 60°, then the program should branch; otherwise, the execution should continue without branching.”
I have managed to create a conditional statement on my own, but I do not understand the branching part. I have Googled already and have found nothing useful. Can someone explain what I am supposed to do?
**Also, I chose JavaScript for my coding language.
function temperature(z) {
if(z > 80 || z <= 60) {
/*branch program?*/;
}
else {
/*do not branch program?*/;
}
}
console.log(temperature(81)); /*evaluates to branching*/
That is all I have so far. Also, is there a simpler way to write that code? I would love some opinions!