Repeat and For loop Usage



Software AG's platform-independent programming language with full support for open-source and Internet applications

Repeat and For loop Usage

Postby diptisaini » Mon Nov 22, 2010 11:56 am

Hi,

I just need to know on what cases Repeat and For loop is used. Can you please explain me with some examples?

Thanks
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Repeat and For loop Usage

Postby RGZbrog » Mon Nov 22, 2010 11:57 pm

FOR is used typically to process an array. The syntax allows a starting value, ending value, and increment of an index variable.

REPEAT can be used to execute a block of code UNTIL or WHILE a condition exists, but more often it is used as an infinite loop in which the on-line user determines when to exit by pressing a specific PF key.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: Repeat and For loop Usage

Postby fidelis » Fri Dec 17, 2010 6:51 pm

The FOR statement is just used to initiate a processing loop and to control the number of times the loop is processed. The REPEAT statement is used to initiate a processing loop uncontrolled to number of times the loop is processed, but you can use UNTIL that will process loop until the logical condition becomes true, or can use WHILE that will process loop continued as long as the logical condition is true.
fidelis
 
Posts: 7
Joined: Thu Dec 16, 2010 1:01 am
Location: Brazil
Has thanked: 0 time
Been thanked: 0 time


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post