Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please explain the While x do y command

Status
Not open for further replies.

Rena

Programmer
May 24, 2000
69
US
I am trying to use this command in CRW8. This is an example of the code I have written:
While starthour >= 24 Do
startdate := startdate + 1;
starthour := starthour - 24;
Exit While;
When I try to save this I get the following error:
'exit while' without an enclosing 'while' loop

The on-line help doesn't offer much help in how to write this. Can anybody give me some tips on this command?

Thanks!
 
I'm not sure you need to use a While...Do for this, but
NumberVar starthour ;
NumberVar startdate ;
While starthour >= 24 Do
(
startdate := startdate + 1 ;
starthour := starthour - 24 ;
) ;
starthour

Alternatively,
NumberVar starthour ;
NumberVar startdate ;
If starthour >= 24 then
(
startdate := startdate + 1 ;
starthour := starthour - 24 ;
)
Else
starthour
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top