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. Introduction

Basic Code example

In this example, we'll walk through a simple "Gomelan" code snippet and explain its key features. "Gomelan" is designed to be easy to understand and use, making it a great choice for various programming tasks.

fn multiply(a: Int, b: Int) -> Int;

fn main() -> Int
{
    args: [String] = ["3", "10"];
    a: Int;
    b: Int;
    result: Int;

    for (i: Int = 0 ; i < len(args); i++) {
        a = stringToInt(arg[i]);
        b = stringToInt(arg[i]) + 10;
        result = multiply(a, b);
    }
    return result;
}

fn multiply(a: Int, b: Int) -> Int
{
    result: Int = a * b;
    return result;
}

Output:

30

This code snippet demonstrates several features of "Gomelan," including:

  1. Add prototype of function to use.

  2. Function definitions with parameter types and return types.

  3. Variable declaration and initialization.

  4. A loop to iterate over command line arguments.

  5. Basic arithmetic operations and function calls.

PreviousInstallationNextSyntax Overview

Last updated 1 year ago

Was this helpful?

🌴