Another HB-25 Motor Controller code question
Joe Fishback
Posts: 99
In the documention and sample code for the HB-25 I have questions about the syntax of the code use of the "colon". On the first line of the Initialization part of the program is···· DO: LOOP UNTIL HB25 = 1 . Why is it written that way and not· on two lines
DO
LOOP UNTIL HB = 1
I have also noticed on other code samples a "colon" between statements on one line instead of putting them on seperate lines. What·are the rules for using the "colon" ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
DO
LOOP UNTIL HB = 1
I have also noticed on other code samples a "colon" between statements on one line instead of putting them on seperate lines. What·are the rules for using the "colon" ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
Comments
if i > 5 then goto someplace
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
In PBASIC, a colon can substitute a carriage return in your code. So, you can use a colon anytime you need a new line but don't want to take the space. As Franklin said, why waste two lines when one will do? [noparse]:)[/noparse]
However, the colon cannot be used when executing subroutines. This is because the code cannot return to the point where the subroutine was called if it is not in a new line. Just something to keep in mind if you decide to try using colons in your own code.
Hope this helps!
Jessica
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jessica Uelmen
Education Department
Parallax, Inc.
Thanks, I could not find·anything in the manual on the use of the "colon". That explains alot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
Post Edited (Joe Fishback) : 4/9/2009 11:42:31 PM GMT