Book of MemeLang

Welcome to the official book of MemeLang!

Introduction

MemeLang is a fun programming lang designed for learning and meme.

Hello world

            yep "Hello, World!"
        

Features

Memelang is designed to be fun, easy to learn, and perfect for understanding how programming languages work while enjoying meme-style syntax.

Syntax

Variables

Create variables using any of the following keywords:

        cook my_var = "Hello, MemeLang!"
        spawn num = 42
        summon list = [1, 2, 3, 4, 5]
        drop flag = true
        birth name = "MemeLang"
    

Printing Output

Display text using any of these keywords:

        print "Hello, World!"
        yell "This is MemeLang!"
        cow_say "Moo! MemeLang is fun!"
        moo "MemeLang is udderly amazing!"
        yap "MemeLang is great for learning!"
        scream "MemeLang is the best!"
        announce "MemeLang is here!"
        leak "MemeLang is open source!"
        broadcast "MemeLang is taking over the world!"
        meow "MemeLang is purrfect!"
    

Conditions (If Statements)

Create conditional statements using:

        if x > 10 {
            print "x is greater than 10"
        }

        sus y == "hello" {
            print "y is hello"
        }

        what z < 5 {
            print "z is less than 5"
        }

        vibecheck a != 0 {
            print "a is not zero"
        }

        checkin b >= 100 {
            print "b is at least 100"
        }
    

Else Statements

Use these keywords for alternative execution paths:

        if x > 10 {
            print "x is greater than 10"
        } else {
            print "x is not greater than 10"
        }

        sus y == "hello" {
            print "y is hello"
        } nah {
            print "y is not hello"
        }

        what z < 5 {
            print "z is less than 5"
        } no {
            print "z is not less than 5"
        }

        vibecheck a != 0 {
            print "a is not zero"
        } cap {
            print "a is zero"
        }

        checkin b >= 100 {
            print "b is at least 100"
        } otherwise {
            print "b is less than 100"
        }
    

While Loops

Repeat code while a condition is true using:

        while x < 10 {
            print x
            x = x + 1
        }

        grind y > 0 {
            print y
            y = y - 1
        }

        farm z != "done" {
            print z
            z = get_next()
        }

        loopmaxxing a <= 100 {
            print a
            a = a * 2
        }
    

For Loops

Iterate through collections using:

        for item in my_list {
            print item
        }

        touchgrass element in my_array {
            print element
        }

        repeatbro num in 1..10 {
            print num
        }
    

Functions

Define functions using any of these keywords:

        skill add(a, b) {
            yeet a + b
        }

        function greet(name) {
            yeet "Hello, " + name + "!"
        }

        spell factorial(n) {
            if n <= 1 {
                yeet 1
            } else {
                yeet n * factorial(n - 1)
            }
        }
        move max(a, b) {
            if a > b {
                yeet a
            } else {
                yeet b
            }
        }
    

Supporting Keywords

Keyword Table

Examples

Fibonacci

        cook a = 0
    cook b = 1

    touchgrass item in [1,2,3,4,5,6,7,8] {
        yap a

        cook next = a + b
        a = b
        b = next
    }
    

Multiplication Table

    cook i = 1

    grind i <= 10 {
        yap 5 * i
        i = i + 1
    }
    

Countdown

        cook n = 10

        grind n > 0 {
            yap n
            n = n - 1
        }
        scream "BOOM!"