Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Odd error with functions

Author
Message
Social Disease
22
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 9th Oct 2003 15:40 Edited at: 9th Oct 2003 15:43
Here's a code snippet:

Here's the problem. The loop won't work! can you not use loops inside a function? if that's true, why not! any suggestions how to bypass this?
-Thanx



ps.
Probably would help if I detailed the error!
It says Error#100013: Command out of place at line 190.
(line 190 is loop until done = 1)
This makes me think that I started something somewhere that i didn't end, but as you can see it is all nicely layed out, and complete!
Help!

So many games... so little time!
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 9th Oct 2003 16:02
Change

Do
...
Loop Until done = 1

to

Repeat
...
Until Done = 1

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Oct 2003 16:09
depends what your intended logic was. If you use REPEAT...UNTIL, it will loop one more time when the condition is met. If you want it to end immediately, use WHILE...ENDWHILE

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 9th Oct 2003 16:15
Erm, no it will not run one more time with Repeat/Until. But it will run the loop at least once, because the exit-condition is placed at the end of the loop. If you look at the source you'll notice that repeat/until will work perfectly.

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Social Disease
22
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 9th Oct 2003 22:34
So Repeat... Until will work in a function and Do.... Loop will not?
Is this because I'm using DBpro? or just a peculiarity to both DBpro and DBc?



So many games... so little time!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Oct 2003 22:49
Nope. DO...LOOP do work. It's just the LOOP doesn't allow you to add an exit expression. Your original example code was combining the two loop types illegally.

Login to post a reply

Server time is: 2026-07-08 00:56:00
Your offset time is: 2026-07-08 00:56:00