Skip to main content

rl_lang/docs/entries/concepts/constants/
mod.rs

1use crate::docs::entry::{ConceptCategory, ConceptEntry, DescriptionEntry, DescriptionKind};
2
3pub static CONSTANTS: ConceptEntry = ConceptEntry {
4    name: "constants",
5    descriptions: &[
6        DescriptionEntry {
7            description: "declare a constant with `CONST <type> <name> = <value>` but it cannot be reassigned, convention is UPPER_CASE (but anything works)",
8            examples: &[
9                "CONST int    MAX_SIZE  = 100",
10                "CONST float  EULER     = 2.71828",
11                "CONST bool   DEBUG     = false",
12                "CONST string LANG      = \"rl\"",
13                "CONST char   NEWLINE   = '\\n'",
14            ],
15            kind: DescriptionKind::Explanation,
16            title: None,
17            expected_output: &[],
18        },
19        DescriptionEntry {
20            description: "constant arrays use `CONST arr[<type>]`",
21            examples: &[
22                "CONST arr[int]    PRIMES = [2, 3, 5, 7, 11]",
23                "CONST arr[string] DAYS   = [\"sat\", \"sun\", \"mon\"]",
24            ],
25            kind: DescriptionKind::Explanation,
26            title: None,
27            expected_output: &[],
28        },
29    ],
30    summary: "",
31    category: ConceptCategory::Syntax,
32    prerequisites: &[],
33    pitfalls: &[],
34    related: &[],
35    related_stdlib: &[],
36    since: None,
37};