Futurebasic/Intro/editing/hello world

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The basic 'Hello World' Example looks like this:

     window 1,"Hello World!" 
     print "Hello world"
     do
     Handleevents
     until ( gFBQuit )

Strictly, just 'print "Hello World' would work, but the text in a window is better.

Let's go over the code: window 1,"Hello World"

This line creates a window with the ID number 1 and a title of "Hello World". The ID number is used when showing, hiding, and referring to that window in general.

print "Hello World"

This does not actually print anything out of the printer, just puts those words (Hello world, in this case.) in the current window, that is in this case, the most recently created one: window ID 1.

do

handleevents

until ( gFBQuit )

These lines tell Future BASIC to - until ' gFBQuit ' - 'handle events', that is, to check if the mouse has moved, check if the user has quit, etc. etc. The ( gFBQuit ) is just a synonym for 'The user pressed Quit, or Cmd-Q'.