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.

Author
Message
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 28th Jan 2013 23:59
Hello,

What does " : " stands for in Dark Basic Pro ?

Where can I find listing of the operators and their meaning ?

Thanks,
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jan 2013 00:08
It's like a line delimiter.

This:


Is the same as this:


But for statements like this:


You can use the colon to put multiple things on the same line and they will be treated as part of that originating statement.


Which is the same as:


"You're not going crazy. You're going sane in a crazy world!" ~Tick
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 29th Jan 2013 00:12
In BASIC the : character is a break between statements. Allowing you to stack more than one statement on a line. There's generally a few statements that won't allow this depending on the Dialect of BASIC. But it's fairly universal.



Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 29th Jan 2013 00:22


What does this mean ? There is no if statement involved here.
All the 4 commands will be executed one by one for 0 to 7 ( 8 times ) ?
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 29th Jan 2013 00:42
Quote: "All the 4 commands will be executed one by one for 0 to 7 ( 8 times ) ?"


yep its the same as writting each command to a separate line



Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 29th Jan 2013 00:51
OK. Thank you folks for all the clarification.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Jan 2013 05:57 Edited at: 30th Jan 2013 06:01
As couple of side-notes,
The print statement makes unique use of the semi-colon, which acts differently to the colon, but they can be thought of in a similar way: while a colon says to run the next command on the same line, the semi-colon says to output the next print command on the same output line. If you want to output multiple strings on the same line you only need one print statement. Here are some examples:


Note 2
Colons are also used to define labels, these are like bookmarks in the program. Labels that end with a return statement are called subroutines, this is because they are routines that can be placed outside of the main code and called via the gosub command, when all the code inside the subroutine has been executed and the program comes across the return statement it will return to the place directly after the subroutine was called in the main code.

You can also jump straight to a label by using goto, although this command is rarely used any more since there are so many better ways to control the program flow, and making large jumps around program can quickly disorientate any reader trying to follow it, since goto does not return to where it was called.

Unfortunately, the use of the same symbol (the colon) as both a line delimiter and label definition creates a conflict between the two, and as such, labels require their own line. I.E. the following code will not work as desired:


Meanwhile...

Login to post a reply

Server time is: 2026-07-07 00:29:35
Your offset time is: 2026-07-07 00:29:35