Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

1.1 Introduction

Introduction to Dosato

After you successfully installed Dosato, you can start writing your first Dosato program.

Writing your first Dosato program

Open your favourite text editor and create a new file.
Save the file with the extension .to.
Dosato script files are called .to files.

Info!
Visual Studio Code has a Marketplace extension that provides syntax highlighting.

Now, let's write our first Dosato program.
Type the following code into your text editor:

do say ("Hello world")

Save the file and run it with the Dosato interpreter.
You can run the interpreter by typing dosato and the path to your Dosato script file.
Example: dosato hello.to.
You should see the following output:

Hello world

Congratulations! You just wrote your first Dosato program.
Let's take a closer look at the code.

do // the master keyword do is used to call a function
say // the function say is called 
("Hello world") // the function say takes a string as an argument

The master keyword do is used to call a function.
The function say is called.
The function say takes a string as an argument.
The string is "Hello world".

Info!
A comment is a line that is ignored by the interpreter.
A comment starts with // and ends with a new line.
You can also use /* and */ to create a multi-line comment.

Let's take a look at another example.

do {
    do say ("Hello ")
    do say ("world")
}

do can also be used to call a block.
A block is a group of lines.

Info!
A block starts with { and ends with }.
A block can contain any number of lines.
You can think of a block as a function without a name.

In the next section we will take a look at the two other master keywords.