Jump to content

Run this loop 4 times

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Ryut3k

Ryut3k

    Newbie

  • Members
  • Pip
  • 8 posts
var i = 0;
do {
print("This is iteration " + (i + 1) + ".");
()
}
while();




How can I run this loop 4 times?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
After your print statement, you could increment i by 1, and have a while condition of i<4.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Ryut3k

Ryut3k

    Newbie

  • Members
  • Pip
  • 8 posts
Thanks




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users