Learn Tego
Here are some of the basics of Tego.
Hello world!
Let's write your first "Hello world!" program. Using your text editor of choice,
edit a new file hello-world.tgo and type the following:
main = "Hello world!"
Then, save your file and run it with the following command:
$ tego run hello-world.tgo
It should write Hello world! to the console.
So what's happening here? Quite simply, we assign to main
the value of "Hello world!". When the program runs, it
looks up main and prints out its value. (This is a somewhat
simplified version of what's actually happening, but it will suffice for
now). So you could change "Hello world!" to
"Hello world!!!" and the code would output
"Hello world!!!" to the screen instead.
Coming soon!
- Data types
- If expressions
- Match expressions
- Functions
- Free monoids