GangLang

From Esolang
Jump to navigation Jump to search

GangLang is an esoteric programming language by Wonkanese, is a simple programming language in which the keywords are gang terms or gang related.

Language overview

GangLang can be written and ran on https://wonkanese.github.io/GangLang/

GangLang is an esoteric programming language with a unique twist. In this language, all keywords are related to gang culture and are presented in uppercase letters. It's a simple language that allows you to create variables, perform operations, and control program flow using gang-related keywords. The GangLang compiler is implemented in JavaScript.

Instructions

Below is a detailed explanation of GangLang's syntax and how to use it:

Comments and Ignoring Lines

Any line that starts with a $ at the beginning will be ignored. This is a way to add comments to your GangLang code. Leaving an empty line will also be ignored.

For example: This GangLang program does nothing.

$This program does nothing

$YAY!!!

Variable Declaration

Use the keyword YO GOT GLOCK followed by a variable name and an integer value to create an integer variable.

For example: This program creates a variable called myVar with the value 42

YO GOT GLOCK myVar 42

Output

To print a message or the value of a variable, use the keyword YO RAP followed by the message. If you want to include variables in the message, prefix the variable name with a $.

For example: This program prints Hello, and with the value of myVar which is 10 so it would would "Hello, 10"

YO GOT GLOCK myVar 10
YO RAP Hello, $myVar

Loops

To create loops, use the keyword YO SPIN DA BLOCK followed by the amount of times to loop and for how many lines. You can include variable names instead of integers for the two parameters.

For example: This program prints "HELLO" 5 times and then prints "DONE".

YO SPIN DA BLOCK 5 1
YO RAP HELLO
YO RAP DONE

Variable Operations

You can perform various operations on variables:

YO BIG increases a variable by a specified amount:

YO BIG myVar 10

YO SPRAY multiplies a variable by a specified amount:

YO SPRAY myVar 2

YO LIL subtracts a variable by a specified amount:

YO LIL myVar 5

YO BANG sets a variable to a specified value:

YO BANG myVar 42

YO SMOKE sets a variable to the square root of the specified value:

$myVar will be set to 3
YO SMOKE myVar 9

YO SMOKE myVar2 10
$myVar2 will be set to 3 (rounding)


Conditional Statements

In GangLang you can create conditional statements by using this syntax:

YO IS IT x y THEN z checks if two values (x and y) are equal and if so, runs the next z lines For example: This program will check if var1 is equal to var2. If so, then it will print "both equal" and "hello gangbanger" then "done". Although in this case, they are not equal so it just prints "done".

YO GOT GLOCK var1 2
YO GOT GLOCK var2 2
YO IS IT var1 var2 THEN 2
YO RAP both equal
YO RAP hello gangbanger
YO RAP done

YO IS BIG checks if x is greater then y. If so, runs the next z lines:

YO IS BIG 3 2 THEN 1
YO RAP 3 is bigger then 2

YO IS LIL checks if x is less then y. If so, runs the next z lines:

YO IS LIL 3 2 THEN 1
YO RAP 3 is less then 2
YO RAP 3 might be less then 2?


This should give you a solid understanding of how to use GangLang and its gang-themed syntax. Have fun experimenting with this unique esolang!