April 23, 2024, 08:24:09 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Not often used Cbasic Syntax :)

Started by pistol350, July 02, 2009, 06:25:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

July 02, 2009, 06:25:21 AM Last Edit: September 12, 2009, 07:23:02 AM by Larry McCaughn
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.
Regards,

Peter B.

aurelCB

July 02, 2009, 08:57:31 AM #1 Last Edit: September 12, 2009, 07:23:34 AM by Larry McCaughn
What is that ???
I never see something similiar ::)
#aint[speed] - is that pointer or what?

pistol350

July 02, 2009, 11:44:12 AM #2 Last Edit: September 12, 2009, 07:23:57 AM by Larry McCaughn
Hi Zlatko!
As explained above,

#aint[speed]
and
step aint[speed]

are the same in Cbasic .
Regards,

Peter B.

aurelCB

July 02, 2009, 12:01:50 PM #3 Last Edit: September 12, 2009, 07:24:24 AM by Larry McCaughn
Ahh I see that is just variable name ;D
I think ::)