Skip to main content

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

1use crate::docs::entry::{ConceptCategory, ConceptEntry, DescriptionEntry, DescriptionKind};
2
3pub static VARIABLES: ConceptEntry = ConceptEntry {
4    name: "variables",
5    descriptions: &[
6        DescriptionEntry {
7            description: "declare a mutable variable with `dec <type> <name> = <value>`",
8            examples: &[
9                "dec int x = 10\ndec float y = 3.14\ndec bool flag = true\ndec string name = \"Mohamed\"\ndec char c = 'a'",
10            ],
11            kind: DescriptionKind::Explanation,
12            title: None,
13            expected_output: &[],
14        },
15        DescriptionEntry {
16            description: "reassign a mutable variable with `=`",
17            examples: &["dec int x = 1\nx = 2"],
18            kind: DescriptionKind::Explanation,
19            title: None,
20            expected_output: &[],
21        },
22        DescriptionEntry {
23            description: "compound assignment: `+=`, `-=`, `*=`, `/=`",
24            examples: &[
25                "dec int x = 10\nx += 5   // 15\nx -= 3   // 12\nx *= 2   // 24\nx /= 4   // 6",
26            ],
27            kind: DescriptionKind::Explanation,
28            title: None,
29            expected_output: &[],
30        },
31    ],
32    summary: "",
33    category: ConceptCategory::Syntax,
34    prerequisites: &[],
35    pitfalls: &[],
36    related: &[],
37    related_stdlib: &[],
38    since: None,
39};