Gleam is a statically-typed functional programming language, which recently had its v1 released,  designed for building scalable and maintainable soft

Gleam: A Basic Introduction

submited by
Style Pass
2024-10-11 19:00:03

Gleam is a statically-typed functional programming language, which recently had its v1 released, designed for building scalable and maintainable software. It is inspired by languages like Elm and Rust and compiles down to Erlang, making it well-suited for building concurrent and distributed systems. In this tutorial, we’ll cover the basics of Gleam to help you get started with this expressive and powerful language.

Before diving into Gleam, you need to set up the development environment. The language compiles to Erlang and Javascript, and while the second doesn’t require anything but a browser and the gleam compiler to run, the first will need the compiler, Erlang and Rebar3. Let’s focus on that:

Let’s create a simple “Hello, World!” program to get started. Open your favorite text editor and create a file named hello.gleam with the following content:

Gleam is a statically-typed language, meaning you must declare the type of a variable before using it. Here’s an example demonstrating variable declaration and basic types:

Leave a Comment