47
Views
7
Comments
Solved
Q. Regarding the If Statement, which of the following is false?
Question
Application Type
Reactive

Regarding the If Statement, which of the following is false?

A) The True and False branches are mandatory

B) Only one of the branches is executed, depending on the result of the If condition

C) If statements can also be used to implement loops

D) More branches can be added, if necessary


If statements can't repeat, so this is incorrect.

I think a switch statement would be more appropriate for the statement "More branches can be added," so this sentence is also incorrect.

So, are there two possible answers?

UserImage.jpg
Łukasz Kaproń
Solution

Why answer C is incorrect? What about something like this? 

It works like a loop

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You are right, answer C is correct, you can easily create what is generally called an ad hoc loop with an If.

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

Hello.

A lot of you don't know how to do an ad-hoc loop!

A) The True and False branches are mandatory Yes, both need to exist, even if with nothing on it.

B) Only one of the branches is executed, depending on the result of the If condition Yes, that is the point.

C) If statements can also be used to implement loops Yes, they are called ad-hoc loops. 

D) More branches can be added, if necessary. You can't add branches to an If, only to a Switch.


More details on the ad-hoc loop:

OutSystems only has ForEach to do loops. The alternative to For and While loops is done with an If.

  • If <something>, do this.
  • Increment variable.
  • Go back to if.

It will repeat a few times and them go away.

2025-08-07 06-30-56
Amit J
Champion

A) The True and False branches are mandatory – true

B) Only one of the branches is executed, depending on the result of the If condition – true

C) If statements can also be used to implement loops – false

D) More branches can be added, if necessary – misleading or partially false

2025-08-07 06-30-56
Amit J
Champion

If statements are for conditional branching, not iteration. You need a loop (e.g., for, while) to repeat actions.

If statements typically support two branches only: True and False.

If you want more than two conditions, you use nested ifs or a switch/case structure. So while you can simulate more branches, it's not that If natively supports them.

This statement is misleading and arguably false,

2025-07-28 06-45-20
Rupesh Patil

hi @TravelerAutumn 

1) The True and False branches are mandatory : True : In OutSystems, an If node always has both a True and False connector.

2) Only one of the branches is executed, depending on the result of the If condition True : The condition is evaluated, and the flow continues only through one branch.

3) If statements can also be used to implement loops False : In OutSystems, an If is purely a conditional branch; it doesn’t create loops. Loops are implemented using a For Each or While node, not an If.

D) More branches can be added, if necessary True : You can chain multiple Ifs or use Switch-like patterns, though not in a single If node.

Correct Answer: C — An If statement in OutSystems cannot directly implement loops.

I hope this helps

Thanks

UserImage.jpg
Łukasz Kaproń
Solution

Why answer C is incorrect? What about something like this? 

It works like a loop

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You are right, answer C is correct, you can easily create what is generally called an ad hoc loop with an If.

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

Hello.

A lot of you don't know how to do an ad-hoc loop!

A) The True and False branches are mandatory Yes, both need to exist, even if with nothing on it.

B) Only one of the branches is executed, depending on the result of the If condition Yes, that is the point.

C) If statements can also be used to implement loops Yes, they are called ad-hoc loops. 

D) More branches can be added, if necessary. You can't add branches to an If, only to a Switch.


More details on the ad-hoc loop:

OutSystems only has ForEach to do loops. The alternative to For and While loops is done with an If.

  • If <something>, do this.
  • Increment variable.
  • Go back to if.

It will repeat a few times and them go away.

2018-06-08 15-13-30
Ricardo Cebola

It is like Nuno said. Let me just ad that these ad-hoc loops have the potential to be "infinite loops" so always make sure the exit condition is reachable. 

Eventually you will reach a timeout on the thread unless you are on a heavy timer that wakes itself up or similar - that should have a failsafe to break the loop easier.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.