IonicWind Software

Creative Basic => General Questions => Topic started by: pistol350 on July 02, 2009, 06:25:21 AM

Title: Not often used Cbasic Syntax :)
Post by: pistol350 on July 02, 2009, 06:25:21 AM
While converting an old Cbasic program to Ebasic, I found this particular code :
Pay attention to the first line with the FOR statement
It took me a few minutes searching The Cbasic User guide to figure out what that meant.
See the extract below :


...
for ang=0 to (1815*speed) #aint[speed]
    ca360=ang
    ca=-1*(ca360-90)
    pinx=cosd(ca)*halfs
    piny=sind(ca)*halfs
    rody=sqrt(rodl^2 + pinx^2)
    pispin=rody+piny
    pistop=pispin+ch
    roda=atan(pinx/rody)/deg2rad
    rodw=3.500
'convert rod angle to radians
 rarad=roda*deg2rad
    gosub draw
next ang
...



QuoteSTEP Usage

FOR loopvar = startno TO endno #stepno
----- OR -----

FOR loopvar = startno TO endno STEP stepno

Also

QuoteFOR variable = start TO end {# skip}
â€Ã,¦
NEXT variable

FOR counter = 1 TO 20 #2
   PRINT "Hello ",name$
NEXT counter

Hope this TIPS can be helpful to anyone.
Title: Re: Not often used Cbasic Syntax :)
Post by: aurelCB on July 02, 2009, 08:57:31 AM
What is that ???
I never see something similiar ::)
#aint[speed] - is that pointer or what?
Title: Re: Not often used Cbasic Syntax :)
Post by: pistol350 on July 02, 2009, 11:44:12 AM
Hi Zlatko!
As explained above,

#aint[speed]
and
step aint[speed]

are the same in Cbasic .
Title: Re: Not often used Cbasic Syntax :)
Post by: aurelCB on July 02, 2009, 12:01:50 PM
Ahh I see that is just variable name ;D
I think ::)