Clarification for If & While Loops


#1

Functionality-wise, what's the difference between an "if" loop and a "while" loop?


#2

if is not a loop.

if allows for conditional execution of code fragments. If the condition is met the block of code will be executed only once.

while allows to execute fragment of code again and again as long as the condition evaluates to true.


#3

Thank you! What would you define "if" as, a statement?


#4

You're very welcome! :slight_smile:

Statement, construct seems accurate. Loop implies that code will be executed few times.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.