Learn Clyp

Practical examples to get you started

Getting Started

Hello World

A simple greeting program showing variable declaration and function definition.

hello_world.clyp
# A simple "Hello, World!" program in Clyp
str name = "World";
print("Hello, " + name + "!");

# Define a function to greet someone
function greet(str person) returns str {
    return "Greetings, " + person + "!";
}

# Call the function and print the result
print(greet("Clyp Developer"));

Data & Structures

Data Structures

Working with lists, chunking, and flattening operations.

data_structures.clyp
# Working with data structures in Clyp
list[int] numbers = [1, 2, 3, 4, 5, 6];
print("Original list:");
print(numbers);

# Get chunks of the list
list[list[int]] chunks = chunk(numbers, 2);
print("List chunked into size 2:");
print(chunks);

# Flatten the list back
list[int] flattened = flatten(chunks);
print("Flattened list:");
print(flattened);

# Repeat loop for iteration
repeat 3 {
    print("Hello from a repeat loop!");
}

Advanced Features

Advanced Features

Classes, conditionals, and the powerful pipeline operator.

advanced.clyp
# Advanced Clyp features
class Counter {
    int count = 0;
    
    increment(self) returns null {
        self.count = self.count + 1;
    }

    get_count(self) returns int {
        return self.count;
    }
};

let c = Counter();
c.increment();
c.increment();
print("Count is: " + toString(c.get_count()));

Ready to try Clyp yourself?

Install Clyp and start experimenting with these examples on your local machine.

pip install clyp