bwBASIC 2.50
Version of implementation Bywater BASIC of programming language BasicThe last version of Bywater BASIC, released in 1997.
Examples:
Hello, World! - Basic (31):
PRINT "Hello, World!"
Factorial - Basic (464):
Factorials are calculated iteratively. Note the type inference: data type for storing factorial values is not declared explicitly, and yet the larger values are calculated without an overflow error.
f = 1
FOR i = 0 TO 16
PRINT i; "! ="; f
f = f * (i + 1)
NEXT i
Fibonacci numbers - Basic (465):
This example shows iterative calculation of Fibonacci numbers and storing them in an array. Note the explicit array declaration and the string variable S$
— string variables names must end with a $
.
DIM F(16)
F(1) = 1
F(2) = 1
FOR i = 3 TO 16
F(i) = F(i - 1) + F(i - 2)
NEXT i
S$ = ""
FOR i = 1 TO 16
S$ = S$ + STR$(F(i)) + ","
NEXT i
S$ = S$ + " ..."
PRINT S$
Comments
]]>blog comments powered by Disqus
]]>