User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 428,572 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,611 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting

Loop...without the loop

Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,959
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Loop...without the loop

  #3  
Jun 24th, 2003
Just noticed you wrote this isn't in Java, it's in JKarel. I downloaded the JKarel Users Manual you provided a link to, and it says to do this:

loop(1000)
{
     moveMile();
}

or, alternatively

int i = 0;
while (i < 1000)
{
     moveMile();
     i++;
}

Actually, I would assume if your teacher/professor said not to use a "loop" he was referring to the former and wants you to use "while" instead. However, in real programming, the former refers to a for loop while the later refers to a while loop.

In any case, I'm not sure if you can use the code for the "while" I've provided only because I don't see that JKarel supports variables of any kind - only calling functions.
Reply With Quote  
All times are GMT -4. The time now is 11:17 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC