For beginners, whichever programming language you are learning, it might be difficult to distinguish between an if statement and a while loop. In this blog post, I’ll take Python and Javascript as examples to illustrate the differences between the two.

Both statements are made up of two parts:

  1. Condition statement; and
  2. Conditional code.

Conditional code will be execuated only if the condition statements are true.

Okay, those are the similaries. What about the differences? The major difference is that in an …