Sharp Tutorial
loop in js

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

Java Script

  • java script home
  • introduction
  • Variable Declare & Make Comment
  • operator
  • if else
  • loop
  • Array
  • Function
  • Java Script Objects
  • Java Script DOM

JS based examples

  • two number sum and diff programs
  • Pattern program in java script
  • zumble word quiz
  • Random number guess program
  • calculator in java script
  • digital clock in java script

Understanding loops in JS

Suppose block of statements has to be executed repeatedly, then instead of writing those statements multiple times, loops are used.

The looping statements are used to execute a single statement or block of statements repeatedly until the given condition is FALSE. So if  i have to print myname 100 times, then instead of writing printf hundred times, we can use loop with condition that executes 100 times.

Types of the Loops in C :

  1. while statement
  2. do-while statement
  3. for statement

Syntax for while loop

while(condition here) 
{
/*statement to be executed for true condition*/
}

For Loop

In for loop, the first part begins with variable’s  initialization, followed by the condition and increment/decrement operation on the variable.
The first part (initialization) and the last part (increment/decrement) may not be present, but the semicolon is there.

for(initialization; condition; increment/decrement)

{
// body statement to be executed
}

Do while loop

Syntax for do while

   do
{
// body statement to be executed
}
while (condition here);

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial