Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sketch of the class syntax for Leet
module sample
import io
/**
* Greeting class.
*
* Stores a list of greetings and prints them to the
* screen upon request
*/
class SampleGreeter {
-String[] greetings = [];
initialise(String[] greetings) {
this.greetings = greetings;
}
+@Null doGreeting() {
foreach (String greeting in this.greetings) {
io.print(greeting);
Number stringValue = num(greeting);
}
}
}
// Create a new greeter with the traditional text
SampleGreeter greeter = new SampleGreeter(["Hello", "World!"]);
// Hello World!
greeter.doGreeting();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment