FOR EACH and DO

Yohn

Member
Hy.

I have button name button3 and on choose of this button it must display a Message displaying Yohn ten times. I try it to do with FOR EACH block, but error cums.

code sample:
DEFINE VARIABLE iBrojac AS INTEGER NO-UNDO.
DEFINE VARIABLE cIme AS CHARACTER NO-UNDO.


ON CHOOSE OF Button3
DO:
FOR EACH iBrojac = 1 TO 10:
cIme = cIme + "Ivan" + STRING(iBrojac).
END.
END.


thx.
 
I think that what you want to do is a DO.


DO iBrojac = 1 TO 10:
cIme = cIme + "Ivan" + STRING(iBrojac).
END.

You use DO statement this way to di the cicle a predefined number of times.
FOR EACH is used to specify a dynamic condition ( accessing a table in a database or something like that ), as f.e. in a
"
FOR EACH client WHERE client.surname = 'DAMON':
[do something]
END.

"
 
Back
Top