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 Professional Discussion / Does anyone have trouble with this simple code.

Author
Message
The Cubist
23
Years of Service
User Offline
Joined: 26th Mar 2003
Location:
Posted: 27th Mar 2003 06:32

TYPE X AS FLOAT
x=200.2
FOR I= 1 TO 10
PRINT X
X=X+.1
NEXT I
EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 27th Mar 2003 06:33
What happens when you run it?

EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 27th Mar 2003 06:35
Aren't you just supposed to say:

X AS FLOAT

"TYPE" is a command to start defining a new type, isn't it? It's supposed to be followed by "ENDTYPE" eventually... maybe you're getting a compiler error on this code?

EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 27th Mar 2003 06:37
Use "X AS FLOAT" and put a "WAIT KEY" at the end.

EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 27th Mar 2003 06:38
That what you're looking to happen?

The Cubist
23
Years of Service
User Offline
Joined: 26th Mar 2003
Location:
Posted: 27th Mar 2003 07:03
I've tried many different forms such as:
x as float
x as double float
type x as float

type
x as float
end type

the program runs but never prints out anything. all I'm trying to do is get
numbers that represent decimal places>(

The Cubist
23
Years of Service
User Offline
Joined: 26th Mar 2003
Location:
Posted: 27th Mar 2003 07:05
Thanks to Ed this code worked
X AS FLOAT
x=200.2
FOR I= 1 TO 10
PRINT X
X=X+.1
NEXT I
wait key

Login to post a reply

Server time is: 2026-07-11 14:37:19
Your offset time is: 2026-07-11 14:37:19