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 Professional Discussion / "Else *No Parameter*" error

Author
Message
Schaef
16
Years of Service
User Offline
Joined: 15th Oct 2009
Location:
Posted: 21st May 2010 03:27
I have just started programming with darkBASIC and I was trying some simple programs from Qbasic to experiment and get used to the interface, but whenever I try to use an if-then decision with an "else" statement, I get an error that says "Else *No Parameter*". If anybody has any ideas, that would be really helpful.
Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st May 2010 03:43 Edited at: 21st May 2010 03:44
Here's two examples of using else statement:

1) if a=1 then b=1 else b=2
2)
if a=1
b=1
else
b=2
endif

"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrash
Schaef
16
Years of Service
User Offline
Joined: 15th Oct 2009
Location:
Posted: 21st May 2010 08:18
Well, here's the code I was using, sorry for not posting it earlier.

print "Please enter Y"
input InputKeyEnter$
if InputKeyEnter$ = "Y" then
print "You pressed the right key"
else
print "You pressed the wrong key"
endif

But whenever I do this, I keep getting that error again. I have no idea why this is happening, because I'm pretty sure that it shouldn't be.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st May 2010 08:29 Edited at: 21st May 2010 08:33
[EDIT]
Brendy Boy's explanation is much better, I'll just back out slowly as if I just farted .


Health, Ammo, and bacon and eggs!
Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st May 2010 08:30
print "Please enter Y"
input InputKeyEnter$
if InputKeyEnter$ = "Y" then
print "You pressed the right key"
else
print "You pressed the wrong key"
endif

remove the bolded then. Use then only if your entire statement is in the same line. If you spread it accross multiple lines you don't need then. You start with IF and end it with ENDIF

"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrash
Schaef
16
Years of Service
User Offline
Joined: 15th Oct 2009
Location:
Posted: 21st May 2010 08:41
Thanks for the help. It's a little trickier converting from Qbasic to Dark than I thought it would be. I never got that error in Q, but meh, thats what the learning process is for.

Login to post a reply

Server time is: 2026-07-25 16:20:12
Your offset time is: 2026-07-25 16:20:12