Hello World Program
Whenever introducing a new computer language such as Ubercode, it is traditional to show the "Hello World" program. This is the simplest program possible
that shows something on the screen:
// "Hello World" program
Ubercode 1 class HelloWorld
public function Main()
code
call Msgbox("Hello", "My first program")
end function
end class
This is a very simple program. The first line shown (with the forward slashes) is a comment. The line with the class keyword is the name of the class
(program) and the name of the file containing the class. The two names always match, so class HelloWorld is stored in the file "HelloWorld.cls". The
program contains one function called Main which runs first. The name Main is not case sensitive, so either Main or main could be
used. The Msgbox function is included in the Ubercode run time library and the first parameter is the caption and the second parameter is the text shown
in the message box. When the program is compiled and run, its output looks like this:

How to run the program
Start the Developer Environment by double clicking the icon on the desktop:

When the Developer Environment starts up, it shows a window titled Startup Wizard. We don't need the wizard for now, so click the Close button to
make it go away. Back in the Developer Environment, use the File - New - Text file command to create a blank window. Your desktop should now look
similar to this:

Now type in the program as shown previously (everything from //... to end class) although you can skip the comment if you want. You can also copy and
paste the text from above. When typing the program, it doesn't matter whether you enter words in upper or lower case, and extra spaces or missing spaces don't
matter. But don't put spaces in the middle or words or change the spelling of the words.
Now you compile the program and run it. Click the Run button shown with the red arrow. You will be prompted to save the program after which the compiler
will start:

Wait a few moments for the program to compile and start running, then you should see the the Hello World window which is shown as follows:

The program is now running as a real Windows EXE file, also called an executable file or an application. When you've finished click the OK
button to end the program. That's it!
|