Greentext
Jump to navigation
Jump to search
- This is still a work in progress. It may be changed in the future.
| Paradigm(s) | imperative |
|---|---|
| Designed by | Jfeng41 |
| Appeared in | 2015 |
| Computational class | Turing complete |
| Reference implementation | Greentext Github |
| File extension(s) | .gt |
Greentext is a work-in-progress esoteric scripting language based off of the trademark greentext format (or "Meme Arrows") of the anonymous forum site 4chan. Every line in the language begins with a >.
A Basic Rundown
Booleans
:^) = true :^( = false
Printing
>mfw "Hello World!"
Variable assignment
>be foo # Declare unassigned variable "foo" >be bar like 1234 # Dclare variable "bar" and assign it the value 1234
If Statements
>implying foo is bar # if "foo" is equal to "bar"
>mfw "True"
>Or not # else
>mfw "False"
>done implying
("else if" statements have not been implemented as of November 12, 2015)
For Loops
>inb4 i from 10 to 0 by -2 # Variable decrement variable i from 10 to 0 with step counter -2
>mfw i # Prints 10, 8, 6, 4, 2 on separate lines
>done inb4
Main Function
>dank memes # Main function
#Code n stuff
>tfw # Return
Function Declaration
>wewlad foobar (n,m) # Declare function
>be barfoo like n + m # Define variable "barfoo"
>tfw barfoo # Return barfoo
Function Usage
>wew foobar(2,3) # wew is an internal variable that contains the value returned by the last function used. >be baw like wew # Assign the value in "wew" to "baw" >mfw baw # 5
Examples
Fizzbuzz
>dank memes
>inb4 i from 0 to 100 by 1
>implying i % 15 is 0
>mfw "fizzbuzz", i
>or not
>implying i % 3 is 0
>mfw "fizz", i
>done implying
>implying i % 5 is 0
>mfw "buzz", i
>done implying
>done implying
>done inb4
>tfw
Fibonacci sequence
>wewlad factorial(n)
>be result like 1
>implying n > 1
>be m like n - 1
>wew factorial(m)
>be result like wew
>done implying
>tfw n * r
>dank memes
>be n like 10
>wew factorial(n)
>mfw wew # Outputs n!
>tfw