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
  • Basic Types
  • Char
  • Int
  • String
  • Float
  • Bool
  • Type Conversion

Was this helpful?

Edit on GitHub
  1. Features

Types

In GoMelan, types are kept simple.

Basic Types

Here is the list of all the types you can find alongside a small example of how to use it.

Char

Chars in GoMelan represent individual characters. You can declare a Char variable and assign a single character to it. Additionally, you can create Char arrays, such as strings.

myChar: Char = 'a';
alphabet: [Char] = "abcdefghijklmnopqrstuvwxyz";
dLetter: Char = alphabet[3]; // dLetter = 'd'

Int

Integers in GoMelan are used to represent whole numbers. You can declare Int variables and perform various arithmetic operations on them.

myInt: Int = 42;
result: Int = myInt + 8; // result = 50

String

Strings in GoMelan are sequences of characters. You can declare String variables and perform operations like concatenation.

greeting: String = "Hello";
name: String = "GoMelan";
message: String = greeting + ", " + name + "!"; // message = "Hello, GoMelan!"

Float

Floats in GoMelan are used to represent decimal numbers. You can declare Float variables and perform various arithmetic operations, including floating-point division.

myFloat: Float = 3.14;
result: Float = myFloat * 2; // result = 6.28

Bool

Booleans in GoMelan represent logical values, either true or false. You can use Bool variables in conditional statements and logical operations.

isTrue: Bool = true;
isFalse: Bool = false;
result: Bool = isTrue && isFalse; // result = false

These are the basic types in GoMelan, providing a foundation for representing characters, integers, strings, floating-point numbers, and boolean values.

Type Conversion

Internal Functions

stringToInt("42")
=> 42
PreviousVerbose ModeNextOperators

Last updated 1 year ago

Was this helpful?

Keep in mind that String is just an alias for [Char]. More information .

In GoMelan some allow you to go even further with types. For example, you can convert any to an and vice-versa.

✨
here
internal functions
String
Int