Skip to content

Variables

Dennis Rönn edited this page Oct 4, 2022 · 1 revision

Variables are a key part of programming. In Dern, variable types are inferred by default.
You declare a variable by the following syntax var <name> = <expression>;.
Dern currently only support 2 data types: Text and Number. Number is currently only Integer type but will be floating point later.

Examples

The basic assignment is very simple:

var name = "Foo";
var number = 5;
var numberTwo = 7;
var numberThree = 5 + 7;

Variables support reassignment by the following example

var name = "Foo";
name = "Bar";

Variables currently also support reassignment of data type, although this is subject to change later

var foo = "Bar";
foo = 5;

Clone this wiki locally