GLaDOS
  • Home
  • 🌴Introduction
    • Installation
    • Basic Code example
    • Syntax Overview
  • 🤖Developpers
    • Parsing
    • Verbose Mode
  • ✨Features
    • Types
    • Operators
    • Lists
    • Includes
    • Syntactic Sugar
    • Loops
    • Conditions
    • Internal Functions
    • Recursivity
    • Prototypes
    • Error handling
    • Comments
    • Scopes
  • 📚Libraries
    • Mathematics
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Features

Scopes

In GoMelan some control structures imply different scopes.

Example for if

fn main() -> Bool
{
    var: Bool = true;

    if (var) {
        inScope: String = "I'm in this scope only"; // inScope will only lie in this condition
        var = false; // var from outter scope will be modified
    }
    
    // inScope cannot be accessed here

    return var; // Returns false
}

The control structure for is also subject to this scope system.

PreviousCommentsNextMathematics

Last updated 1 year ago

Was this helpful?

✨