Jump to content

Yabasic

From Simple English Wikipedia, the free encyclopedia

Yabasic (Yet Another BASIC) is an interpreter program for a version of BASIC. BASIC is a programming language. BASIC was designed by John George Kemeny and Thomas Kurtz, in 1964. Yabasic was born in 1995, 32 years later. Pedro Sá and Thomas Larsen are now developing version 3 of Yabasic. Yasbic is very compact at about 250 kilobytes total length.

How it works

[change | change source]

To write something on the monitor, like Hello World, type print then "YOUR TEXT HERE".

Print "Hello World"

Study this bit of code:

10 beep
20 wait 1
30 goto 10

The result of this code is:
An audible beep is generated
The program waits for 1 second before going onto the next instruction
It then goes back to the start of the program creating an infinite loop.

This programming language can also be used to create rather complex programs such as one that calculates prime numbers

print "This program will calculate the prime numbers below the limit"
input "limit: " limit
n=2
do
  for i=2 to sqrt(n)
    if (frac(n/i)=0) then
      notprime=1
      break
    endif
  next i
  if notprime<>1 then
    print n
  endif
  notprime=0
  n=n+1
  if n>limit break
loop

The "input" command asks the user to input a value which in this case is number that tells the program what number to stop finding prime numbers at.
The

do
...
loop

commands create a loop that can be repeated infinitely.
The

for
...
next

commands hold instructions as to what the program is to do while in the loop.
The

if
...
endif

commands tell the program to look for something and if the thing it is looking for is there then it reports back that it is there.[1] [2][3] [4]

[change | change source]

References

[change | change source]
  1. Tutorial on how to create UDTs in Yabasic 3 Archived 2011-09-10 at the Wayback Machine www.basicprogramming.org
  2. Yabasic::Dev Article Future of Yabasic Archived 2011-09-10 at the Wayback Machine www.basicprogramming.org
  3. Announcement: Yabasic 3 beta release (2.9.5) Archived 2011-10-02 at the Wayback Machine Thomas H. Larsen, via basicprogramming.org forum, 26 November 2009, forum.basicprogramming.org
  4. Wiki of the developer team for Yabasic 3 Archived 2011-09-10 at the Wayback Machine www.basicprogramming.org

Other websites

[change | change source]