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.

DarkBASIC Discussion / Help with Dice Roller Program

Author
Message
LordAnki
21
Years of Service
User Offline
Joined: 22nd Apr 2004
Location:
Posted: 18th Dec 2004 07:44
Okay it says its a module but for right now its a program by itself.

I was wondering if someone could help me with the nesting errors.

Here is the code.



Thanks.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 18th Dec 2004 07:57
for value = a to b
do something
if value = c
do something
else
next value
endif

is pretty illegal

Try it this way:





Remember:
- Close functions with endfunction
- Goto needs a label, in this case we will use start:
- You can mix up things, like you did with the for loop

LordAnki
21
Years of Service
User Offline
Joined: 22nd Apr 2004
Location:
Posted: 18th Dec 2004 08:32
just to let u know. that label dosnt work. thanks for the help.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 19th Dec 2004 03:38
it should work.

There are some ways to improve this though:

- Use a array to store the numbers
- Dont use "Yes" for a comparison, but "YES" instead combined with upper$()
- Replace print&input with input only



LordAnki
21
Years of Service
User Offline
Joined: 22nd Apr 2004
Location:
Posted: 19th Dec 2004 05:19
i keep a no such label in Dark Edit error. But the label is there.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 19th Dec 2004 06:59
That's weird, we could use an loop instead:



LordAnki
21
Years of Service
User Offline
Joined: 22nd Apr 2004
Location:
Posted: 20th Dec 2004 04:25
That works. Thanks EB!

Login to post a reply

Server time is: 2025-05-24 08:00:58
Your offset time is: 2025-05-24 08:00:58