Skip to main content

Data Types

TinyPanda is dynamically typed. You do not declare variable types; types belong to the values. A single variable can hold any type of data and switch types freely over its lifecycle.

bamboo msg = "I am a string!"; // Starts as a String
msg = 42; // Changes to an Integer
msg = 9.99; // Changes to a Float
msg = true; // Changes to a Boolean

TinyPanda supports these fundamental data types:

Strings

Textual data wrapped in double quotes ("...").

TinyPanda only supports double quotes. Single quotes ('...') will cause a syntax error.

bamboo name = "Panda";

Escape Characters

TinyPanda strings support special character combinations starting with a backslash \ to format your console output, while forward slashes / print normally as raw text.

TinyPanda supports two escape characters:

  • \n: Adds a new line in the string.
  • \t: Adds a tab space in the string.
echoln("Hello\tTinyPanda!");
echoln("We are reading\nTinypanda Docs.");
// Outputs:
// Hello TinyPanda!
// We are reading
// TinyPanda Docs.

Integers

Whole numbers (positive, negative, or zero) without decimals.

bamboo age = 22;
bamboo temperature = -5;

Floats

Numbers containing a fractional part or a decimal point. This allows TinyPanda to handle precise continuous measurements or mathematical constants.

bamboo pi = 3.14159;
bamboo price = 99.95;
bamboo negativeFloat = -0.75;

Booleans

Logical truth values: either true or false.

bamboo isHungry = true;