Tutorial Guide

Fast
Track.

A comprehensive introduction for those who want to start building, not just reading.

Step 0

Core Philosophy

Cocotte is designed to be intuitive. It removes the boilerplate associated with low-level languages while retaining their efficiency. In this guide, we will cover everything required to build your first standalone application.

No Experience Required

This tutorial assumes you have never written a line of code. We will use plain English to explain complex computing concepts.
Step 1

Environment Setup

Cocotte is a single binary. To install it on a Unix-like system, execute the following command:

curl -fsSL https://cocotte-lang.pages.dev/install.sh | bash

Windows Users

Use WSL2 (Windows Subsystem for Linux) for the best experience. The above command will work perfectly within a WSL terminal.
Step 2

Data Storage

In programming, we use **Variables** to store information. Think of them as named slots in the computer's memory.

main.cot
# Use 'var' to declare a new variable
var username = "Alex"
var score = 100
var isActive = true

# Use 'print' to display data
print "Player: " + username
print "Current Score: " + score
Step 3

Control Logic

Logic allows your program to make decisions. We use the if keyword to check conditions.

logic.cot
var health = 20

if health > 50
    print "You are in good shape!"
elif health > 0
    print "Warning: Low health."
else
    print "Game Over."
end
Step 4

Iteration

Loops allow you to repeat a block of code multiple times. This is essential for processing lists of data.

loops.cot
# A simple range loop
for i in range(1, 6)
    print "Cycle: " + i
end

# Iterating over a list
var inventory = ["Sword", "Shield", "Potion"]
for item in inventory
    print "Item: " + item
end
Step 5

Abstractions

Functions (declared with func) allow you to group code into reusable blocks.

functions.cot
func calculate_damage(base, multiplier)
    return base * multiplier
end

var finalDamage = calculate_damage(10, 2.5)
print "Total Damage: " + finalDamage
Step 6

Object Orientation

Classes are blueprints for creating complex data structures that bundle both data and functionality.

objects.cot
class Character
    func init(name, role)
        self.name = name
        self.role = role
    end

    func introduce()
        print "I am " + self.name + ", the " + self.role
    end
end

var p1 = Character("Eldrin", "Mage")
p1.introduce()
Step 7

Validation Project

Building a Guessing Game

This project combines everything we've learned into a functional CLI game.

game.cot
module add "math"

var secret = floor(random() * 10) + 1
var guess = 0

print "--- Cocotte Guessing Game ---"

while guess != secret
    guess = input("Enter your guess (1-10): ")
    guess = abs(guess) # Convert string to number

    if guess < secret
        print "Higher..."
    elif guess > secret
        print "Lower..."
    else
        print "Correct! The number was " + secret
    end
end

You've Completed the Fast-Track!

You now have a solid understanding of Cocotte's core mechanics. Where will you go from here?

Technologies Budgie — Quebec, Canada

Documentation updated March 2026