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 / Colon Question

Author
Message
Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 15th Jun 2009 03:44
If I place a rem statement after a command, do I need a colon to separate them?

example


I noticed the book has this all the time.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 15th Jun 2009 03:46
yes you do need the colon, otherwise DBC views it all as one command and calls a syntax error

There are only 10 kinds of people in the world, those who understand binary and those who dont
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Jun 2009 09:18
A colon will let you stack multiple commands on one line:



And while we are here, is there a way put a command on the same line as the rem after the rem?



I'm not sure if the above code works or not...

TheComet


Make the path of your enemies easier with Waypoint Pro!
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 17th Jun 2009 10:58
look at this

it shows 3 things
1.can put a "if endif" on 1 line

2.if you put a : after a "if then", it will do both commands
ONLY if the statement is true

3.the "print "bob2" does'nt work.

If at first you don't succeed-Pause-Go to last checkpoint
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Jun 2009 16:53 Edited at: 17th Jun 2009 16:55
Just think of a colon as the start of a new line.
You can also put multiple statements after an IF
if mouseclick()=1 then print "You clicked the mouse!" : wait 1000
The program will only wait for a second if the mouse is clicked; the wait is part of the if statement. That's one of colon's peculiarities that can be quite useful.
DB makes it a bit confusing by using it to define labels too

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Jun 2009 17:42
right I dont understand why they did that

and no once you have declared a rem in a line to my knowledge you cant go back to code in that line after it

There are only 10 kinds of people in the world, those who understand binary and those who dont
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Jun 2009 17:57
Smartguy is right, it treats everything after the rem as remarks

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Jun 2009 19:01
Except for:



TheComet


Make the path of your enemies easier with Waypoint Pro!
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Jun 2009 03:29 Edited at: 18th Jun 2009 03:30
well thats not rem is it you cheat
but a good example.
Why don't we just write our whole programs on one line
Damn line limits!

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 18th Jun 2009 23:53
right I tried to run a 20 line challenge program that soemone else wrote a while back and got a line limit error

There are only 10 kinds of people in the world, those who understand binary and those who dont
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Jun 2009 01:23
I think DBC stores each line as one string, so that limits it to 255 characters.
I don't know how DBP does it.

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer

Login to post a reply

Server time is: 2024-05-20 11:14:47
Your offset time is: 2024-05-20 11:14:47