Skip to main content

First Program

TinyPanda

Now that TinyPanda is installed, we can start writing and running our own programs.

TinyPanda code is saved in files with the .tp extension, and you run them using the tinypanda run <file.tp> command in your terminal.

Hello TinyPanda​

Create a file named main.tp:

main.tp
// This is our first program

bamboo name = "TinyPanda";

bamboo sayHello = fn(name) {
echoln("Hello", name);
}

sayHello(name);

Run it with:

tinypanda run main.tp

Output:

Hello TinyPanda

Another Example​

Let's look at another program that adds two numbers.

add.tp
bamboo add = fn(a, b) {
return a + b;
}

bamboo result = add(10, 20);

echoln("10 + 20 =", result);

Run it with:

tinypanda run add.tp

Output:

10 + 20 = 30