faq | docs | tutorials | guide | reference | contact | home  

TUTORIAL - HELLO WORLD Previous | Next | Tutorial Home

The “Hello World” program is the default minimalist program for comparing various programming languages. In FGL, the web version of the Hello World program can be rendered in one of several different methods, including:

Default Hello World program - Active Page version:
<html>
<head>
 <title>Hello World program</title>
</head>
<body text=black bgcolor=white>

<[ ! "Hello World" ]><br>

- or -

<[ ! "Hello" + " " + "World" ]><br>

- or -

<[
    ! "Hello "
    ! "World"
]>

</body>
</html>

Variation of default Hello World program - Active Page version:
<[
    msg = "Hello World"
]>
<html>
<head>
 <title>Hello World program</title>
</head>
<body text=black bgcolor=white>

<[ ! msg ]>

</body>
</html>

FGL can also be used to create standalone “console” applications. These are created by compiling FGL programs (having the .FGL file extension) into EXE files that can be run directly from the command line or through the services interface. FGL EXE programs are created by using the FGL Compiler (SLANG.EXE) on one or more .FGL source files (with optional FGL libraries) to create object-code, then using the FGL Linker (SLINK.EXE) to create the EXE file. Output is displayed in the FGL console window. For example:

Hello World program - Console version:
println( ">>> Hello World!" )

Hello World program - Variant Console version:
FUNCTION main( )
    println( ">>> Hello World!" )
END

The above FGL console "Hello World" example programs compile into a 5k EXE file and generates the following output in the FGL console window when run:

Either console method can be used. In the first example, the println( ) function is used by itself. In absence of a specific “main” function, FGL will look for the first “non-wrapped” section of code and automatically define that as the “implied” main function. The second example uses a specifically defined main function. In either case, only one main function may be used in any FGL program (Note that the use of upper and lower case characters is strictly for readability and does not affect the compiler one way or another).

#####