An if statement is a form of conditional statement that enables or disables the execution of a group of statements based on the evaluation of a condition. More elaborate forms include the if-then-else statement and the if-then-elsif statement.
14
votes
5answers
2k views
If Else - Repeated Code Logic
My boss gave me a project with a particular logic. I have to develop a web page which has to lead the navigator through many cases until he/she arrives at the product.
This is the path scheme of the ...
2
votes
4answers
159 views
Overwriting and returning the value of the argument used as conditional of an if statement, inside the same if statement
A simplified example:
function logTheColor (color){
if(color == "red"){
color = "The color is red "
} else if (color == "yellow") {
color = "The color is yellow "
} else {
...
0
votes
4answers
350 views
What if(event) statement means in JavaScript? [closed]
I'm rather new to JavaScript and programming in general so I am pretty much only used to seeing if statements that have some kind of comparison operator like, if (x < 10) or if(myBool).
I have ...
-3
votes
1answer
307 views
Is it possible to go back to a previous statement c++ [closed]
So I'm learning the basics with C++, and I've created a small text based shopping mall which asks the user if they'd like to buy an item. If the user responds with yes, or any variant of yes, it'll ...
2
votes
2answers
185 views
In an if statement, what are an “if clause” and a “then clause”?
I am a bit confused about the nomenclature for the parts of an if statement. Consider the following example:
1: if condition then
2: statement_1;
3: else
4: statement_2;
5: end if;
...