Learn to Code via Tutorials on Repl.it!

← Back to all posts
CookeyLang Tutorial

Cookeylang Tutorial

This has been the tutorial we have all been waiting on. The creators of CookeyLang finally creating a tutorial about it! Unsurprisingly, this tutorial was built and compiled in CookeyLang.

Table of Contents

  • Introduction
    • About CookeyLang
    • Get Started
      • Usage on repl.it
    • CookeyLang versioning
      • Why did we start on 2?
  • Basic Syntax
    • comments
      • motivation of %
    • if statements
      • motivation of el
    • type casting
      • future of type casting
  • Variables
    • Dynamic variables
      • Assignment
    • Constant variables
    • Types
      • Special Cast
  • Functions
    • Builtin Functions
    • Creating Functions
      • Motivation of ret
  • Logic
    • Conditionals
      • Motivation of or and and
    • If statements
    • Loops
  • More
    • CamelCase or snake_case?
    • main.clf vs index.clf
    • How to contribute


Before we start learning CookeyLang, one must first understand the motivations of this language.

About CookeyLang

CookeyLang, or Cookey was created as a simple language for beginners. Don't worry, we are still developing CookeyLang3! (@Codemonkey51, @RaidTheWeb, @Summit). The github source code can be found here.

Get Started

Coding in CookeyLang requires minimal setup. All you need is the node interpreter, and npm. To make sure these things, work, try doing something like (this is bash):

Usage on repl.it

Using cookeylang on repl.it is more than easy! Create a bash repl, and add this to your main.sh:

Create an index.clf, and you are ready to code some Cookey!

CookeyLang Versioning

CookeyLang 1 was never a thing. CookeyLang 2 is the current version of CookeyLang. CookeyLang3 is still in the works and will incorporate many new features and will fix old concept errors and confusing aspects of the language. We will also aim to make hard things easy, and impossible things (http requests, among others), easy, or in the worst case, hard.

Why did we start on 2?

We actually do have a version one (no version 0) as the originally implementers wrote it in ohm, and there was no specification yet. Evidently, we could not support chaos, so the version was deprecated. Version one however, still inspires the many features we have today and in version 3.

Basic Syntax

Before we start coding things with CookeyLang, we must first understand CookeyLang.


Single line comments look like this:

Multiline comments look like this:

Motivation for %

The % operator is used only for modulous in most C-family languages. This is a waste of such a character. We adapted the % character for comments because they can clearly state where a comment starts and ends.

if statements

if statements will be covered in more depth in logic. For now, just know:

Seem familiar? This is because CookeyLang is a C-family langauge.

Motivation of el

The el keyword was used because it has the same length as if, making it easier to see the code.

Type casting

It may be apparant we can't do:

In Cookey, we have type casting so we can make this work:

We will cover more of this in variables.

Future of type casting

Soon, we will make the casts get classes in CookeyLang 3:

The motivation for this is so we can allow custom classes to be able to be casted as well.


Where more to store memory than in variables?

Dynamic variables

This is the most common type of a variable you will see.

An example variable is:


To change variables, we have many types of operators.
The most simple way would be:

Do note assignment only works for variables that were already defined!

Assignment equals
We also have some handy assignment equals:

The ^ operator is exponentation, like in math class.

Finally, we have some postfix operators:

There are no prefix operators, but postfix operators are known to act like prefix operators. Such undefined behavior will be fixed in CookeyLang3!


Variables can be constant too.

As you can test, PI++ will throw an error!


There are many types in cookey.
| Type | Description |
| NaV | equivalent to null in C |
| true, false | booleans |
| 1, -1, 0.1 | numbers |
| "", '' | strings. Do note that they can be multiline. |

You can find more descriptions of them in the official website

Special Cast

There is a special thing with casting types. In the development of the language, I wanted to make undefined variables throw errors, but still have an ability for users who knew the variable didn't exist to still use them. This was the NaV cast.

It returns the value unless the value is not defined.


Functions allow us to recreate code and write less code.

Builtin Functions

There are many builtin functions in CookeyLang. We will explore the most important ones.

exit is not necessarily a function, but it is too important to be left out.

Creating Functions

You can create functions quite simply. The syntax looks like,

An example function looks like:

Note that the ret is used to return code.

Motivation for ret

This was more of a choice from the el of else for consistency, as well as the fact that return has always been a variable name we have most likely wanted to use at some point in coding.


What is a good programming language with logic?


We have two short-circuiting functions, the ubiquitous or and and.

Motivation of or and and

This was an inspiration from ruby's or and and as the choice of && and || were arbitrary. We still do have the unary ! operator so one never has to add more spaces and words than necessary, as in this example:

CookeyLang wants to promote good practices, but we don't want to make it a pain to do that.

If statements

If statements look something like:

As can be seen, curly braces ({) can be omitted for shorter statements.

Valid if statements include:

The second example is to show exactly what else if (in other languages) really represent.


There are 4 kinds of loops. First, we have the common loops:

The syntax follows that of most standard languages. The less intuitive loop, the for loop has the syntax of:

the [initializer] initializes a variable, [condition] is the end value, and [incremeneter] is how much the loop should step. Of course, all the values are optional, and this would be completely valid:

The break statement allows you to break out of loops.

Now, for the new loop only CookeyLang has!

The syntax looks like:

The loop has a few overloads as well, but if you are inclined to learning them, visit the website documentation.

Evidently, the choice of passing in an argument comes off as a very interesting choice for variables are rarely declared this way. Because of this, in CookeyLang 3, the forrep loop will require you to make sure the variable is defined beforehand.


Thank you for reading this tutorial! Evidently, I have not covered everything in this small but powerful language, and I never intended to. Here are some resources and practices to further your learning on this language.

CamelCase or snake_case?

As the language suggest, 'CookeyLang', we are a CamelCased language. This doesn't mean you can't code in snake_case, but we prefer if you were consistent with our standards.

  • Constants should be capitalized (lol I don't even follow this)
  • Classes should be Capitalized. (MyClass instead of myClass)
  • Variable names should describe themselves. (Joe instead of Human instead of HomoSapien)
  • Single line comments unless you need more lines.

main.clf vs index.clf

When in developing this language, parts of our team were python coders. This meant they were accustomed to main.py. However, this language was written in NodeJS, which uses index.js as the starting point. So, which one should you use? I usually use index.clf, but main.clf is used sometimes too (like in the compilation of this tutorial). It is still under debate, and it may never be resolved. Use what comforts you the most, and if it helps, cookey.clf might be the entry point instead.

How to contribute

Thank you for you endeavors! Feel free to fork the main repo here. If you are at any point confused, there is also a discord server so you can chat with the devs!


Thank you for reading this quick CookeyLang tutorial! As promised, the code was compiled in CookeyLang (!!) and the process was very easy :D

Hopefully after reading this tutorial you understand how main.clf works (or at least partially lol)

Special thanks to the CookeyLang team who made CookeyLang the awesome language it is today!

Pings: @elipie @k9chelsea2


Nice, but why on earth was this made in node.js though? I mean, it must be terribly slow...


@fuzzyastrocat lmao I was wondering the same thing

"fast interpreted"


lol maybe @fuzzyastrocat


@Coder100 Not maybe, definitely lol


Well, when life gives you lemons...

...you create a whole new coding language.




yey thanks @PDanielY


Can you add support for getting the length of strings? Like str.length() or length(str).


wow CookeyLang3 already? I'm so old lol I was around when CookeyLang1 was released lol


You can beat Python with this code:

if you do it:
a) I'll laugh because it seems oddly humourous
b) It'll take fewer characters than Python

NaVequivalent to null in C
true, falsebooleans
1, -1, 0.1numbers
"", ''strings. Do note that they can be multiline.

I fixed your table now.


oh lmao @TheForArkLD


thanks rpel.it so mean @TheForArkLD


@Coder100 wait, you forgot to put newline before table.


hey @coder100 and anybody else I'm looking for a team to help out. Assembling one that is. https://join.slack.com/t/directory0/shared_invite/zt-j2tap4lu-PUgYnymFwnFZKA7cjY1YWg
You can join if you want, just make sure to let me know and we'll go from there! Thanks repl.it


@peternielsen112 sure, what's it for?


@Coder100 everything and nothing... web development, mainly but I think it would be a great way to deploy projects to the world. Repl.it is great too but there is more potential through GitHub... if that makes sense. We can still link into Repl using GitHub if you want, anything works. No requirements but I think it would be cool...


If you haven't used Slack before you might need an account but I think that won't be a problem... it's free.


The link does expire in a week tho so if anyone's interested... now or never :D


@peternielsen112 are you working for a company, or is this just for fun? Also why not make a team on Repl.it and then link to Github?


@RayhanADev I'm working for fun
and I can link GitHub to a repl team


@peternielsen112 ah. Just wondering.


@RayhanADev you want in? the link still works


@peternielsen112 mhhh I prefer to freelance my own projects, but if you have an idea I’d love to drop in every now and then!


@RayhanADev we're designing a webapp to sort of give coding advice and all that but I will keep it in mind. You could still join the slack if you want


I was pung

Yay a notification


yay @Summit




POGCHAMP @tsunami21


@Coder100 monkaS




thanks! @adsarebbbad


how do you even make a programming language? @Coder100




pog @elipie


pog @elipie