Objective C while loop - Objective C

What is while loop in Objective C?

In Objective C programming language, a while loop repeatedly executes as long as the condition is true in a targeted statement.Statements may be a single statement or block of statements.The loop iterates while the condition is true. The condition is any expression and true is any non-zero value.

Syntax:
The syntax of a while loop is:


Flow diagram

Objective C while loop

  • If the condition is false, the program control passes to the line immediately after the loop.
  • The condition is tested and if the result is false, the loop body is skipped and the immediate loop is executed.
  • The key point is while loop is the loop that might not ever run.


Example:

The following result is produced on compiling and executing the above code:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Objective C Topics