Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 724 Bytes

variables.md

File metadata and controls

26 lines (19 loc) · 724 Bytes

Variables

In Planck, variable declarations are extremely similar to those in Java or C. They are a type, followed by a list of names.

Type declaration

In Planck, variables are given a type as soon as instantiated. float angle;
char[] name;

Redefining

Variables cannot be declared more than once, with the same type or not. So both of the below are invalid. char a; char a; char a; int a;

In general in Planck, declarations are only of the form [type] [name] ... when they actually allocate space (as variables do). Otherwise, they are in the form [name]: [type] ..., as will be seen in other files.

Examples

int age = 10;
age++;

char grade;
grade = "A";

int count;
count = 6;