Slag:Hello World
From Plasmaworks
Here's "Hello World" in Plasmacore; in console-based Slag you wouldn't extend class Screen:
class Hello : Screen
method init
println( "Hello World! " )
endClass
- Use ':' to specify which base class your class extends (default is "Object"). The example here extends Screen. This is necessary for Plasmacore but you'd leave it off for straight console-based Slag.
- The first class in a file is called the main class. Slag creates an object of the main class upon loading; your main class's init() method should contain or initiate the rest of the program.
- Constructors in Slag are called initializers and are named init.
- Normally a class contains categories for PROPERTIES and METHODS. If a regular method is the first thing defined in your class you can omit the METHODS category header.
- When an example shows a fragment of test code you can typically put it in place of the "println" above to try it out.