RocketLang Documentation

website·Indexed 31 days ago

https://rocket-lang.org

Documentation for RocketLang, a language based on MonkeyLang. This guide covers language specifications including closures, functions, and control expressions, as well as literals for strings, integers, matrices, and HTTP. It includes details on built-in modules for OS, HTTP, and JSON, with version support ranging from v0.21.0 to v0.23.0.

Tokens
64.2K
Snippets
782
Records
833
Agent score
56%

What's inside RocketLang

  1. Overview of RocketLang Planets

    A planet is a reusable RocketLang library consisting of a git repository of .rl files. Planets are stored in the .planets/ directory and tracked via a planets.yml manifest file. They were introduced in version 0.24.
  2. Work with Integer literals in Rocket

    v0.22.1
    Integers in Rocket can be positive or negative and are internally represented as 64-bit integers. Negative integers are created by prefixing the digit with a minus sign (e.g., -456).
    a = 1;
    b = a + 2;
    is_true = 1 == 1;
    is_false = 1 == 2;
  3. Use Boolean literals in Rocket

    v0.21.0
    Booleans in Rocket represent truthiness using true and falsiness using false. They are used in control flows and can be compared using equality (==) and inequality (!=) operators.
    a = true;
    b = false;
    
    is_true = a == a;
    is_false = a == b;
    is_true = a != b;
  4. Represent and use integers in Rocket

    v0.20.1
    In Rocket, integers can be positive or negative and are internally represented as 64-bit integers. Negative integers are created by prefixing the digit with a minus sign (e.g., -456).
    a = 1;
    b = a + 2;
    is_true = 1 == 1;
    is_false = 1 == 2;
  5. Work with Integer literals in Rocket-lang

    Integers in Rocket-lang are internally represented as 64-bit integers. They can be positive or negative; negative integers are created by prefixing the digit with a minus sign (e.g., -456).
    a = 1;
    b = a + 2;
    is_true = 1 == 1;
    is_false = 1 == 2;
  6. Understand the Nil literal in Rocket

    In Rocket, nil represents the absence of a value ("nothing"). It is returned by operations that produce no result (such as puts or empty break/next statements) and can be explicitly created using the nil literal.
  7. Use Boolean literals in Rocket

    Rocket uses true and false as boolean literals for truthiness and falsy values, typically used in control flows and comparison operations.
    a = true;
    b = false;
    
    is_true = a == a;   // true
    is_false = a == b;  // false
    is_true = a != b;   // true
  8. Use HASH literals in Rocket

    Rocket hashes allow keys of various types, including STRING, INTEGER, FLOAT, BOOLEAN, ARRAY, and HASH. NIL and functions are not hashable and cannot be used as keys. Reading a key that does not exist returns nil.
    h = {"a": 1, 2: true, 3.5: "float", true: "bool", [1, 2]: "array"}
    
    puts(h["a"])     // 1
    puts(h[2])       // true
    puts(h[3.5])     // "float"
    puts(h[true])    // "bool"
    puts(h[[1, 2]])  // "array"
  9. Use Boolean literals in Rocket-lang

    v0.20.1
    Booleans in Rocket-lang represent two values: true (truthiness) and false (falsy). They are used for assignments and control flow logic using comparison operators like == (equality) and != (inequality).
    a = true;
    b = false;
    
    is_true = a == a;
    is_false = a == b;
    is_true = a != b;
  10. Understand the Nil literal in Rocket

    v0.19.1
    In Rocket, Nil represents "nothing". It is returned by operations that produce no value (such as puts or an empty break/next block) and can be explicitly generated using the 'nil' literal.
  11. Work with integers in Rocket

    v0.19.1
    Integers in Rocket can be positive or negative and are internally represented as 64-bit integers. Negative integers are defined by prefixing the digit with a minus sign (-).
    a = 1;
    b = a + 2;
    is_true = 1 == 1;
    is_false = 1 == 2;
  12. Use Boolean literals in Rocket

    v0.22.1
    Rocket supports two Boolean values: true (truthiness) and false (falsy). These are used for assignments and control flow logic using standard comparison operators like == and !=.
    a = true;
    b = false;
    
    is_true = a == a;
    is_false = a == b;
    is_true = a != b;