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

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Stuff I use to make videos

Windows notebook – http://amzn.to/2zcXPyF

Apple MacBook Pro – http://amzn.to/2BTJBZ7

Desktop - http://amzn.to/2zct252

Microphone – http://amzn.to/2zcYbW1

notebook mouse – http://amzn.to/2BVs4Q3

Screen Recording Software – Camtasia