Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 636 Bytes

constants.md

File metadata and controls

23 lines (14 loc) · 636 Bytes

A constant is an identifier (name) for a value that cannot change during the execution of the program.

A valid constant name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.

Constants are case-sensitive and have only a single scope, just like variables.

By convention, constant identifiers are always uppercase.

Declaration

Constants can be declared by prepending the const keyword to a variable declaration.

const any foo = 12;

Modifying a constant during runtime will result in an error being thrown.

const any PI = 3.14159;

PI = 1; # Error