The Basics

LichenScript is a lightweight language compiled to JavaScript/C.

Constants and Variables

Constants and variables associate a name with a value of a particular type (such as the number 10 or the string "Hello"). The value of a constant can’t be changed once it’s set, whereas a variable can be set to a different value in the future.

Declaring Constants and Variables

Constants and variables must be declared before they’re used. You declare constants with the const keyword and variables with the let keyword. Here’s an example of how constants and variables can be used to track the number of login attempts a user has made:

const maximumNumberOfLoginAttempts = 10
let currentLoginAttempt = 0

Basic Type

  • unit
  • i32
  • f32
  • i64
  • f64
  • string
  • array
  • Map


const n1 = 1; // i32
const n2 = 1L; // i64
const n3 = 1.0; // f64
const n4 = 1.0f; // f32