Scala While and Do-While Loops

So what is a loop ?
loops allow us to execute a statement or a block of statements multiple times. Like conditional statements, they are controlled by boolean expressions.

The while Statement

  • A while statement has the following syntax:
  • If the condition is true, the statement is executed
  • Then the condition is evaluated again, and if it is still true, the statement is executed again
  • The statement is executed repeatedly until the condition becomes false

The do Statement

The body of a do loop executes at least once

Example :

Apache Spark and Scala Certification Training

Partner Sites

Stuff I use to make videos

Windows notebook –

Apple MacBook Pro –

Desktop -

Microphone –

notebook mouse –

Screen Recording Software – Camtasia