Explore Clyp's features through practical examples
Practical examples to get you started
A simple greeting program showing variable declaration and function definition.
# 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"));
Working with lists, chunking, and flattening operations.
# 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!"); }
Classes, conditionals, and the powerful pipeline operator.
# 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()));
Install Clyp and start experimenting with these examples on your local machine.
pip install clyp