13,627
stars
+0+0+13
471
forks
45
watchers
436
prs
442
issues
37
releases
–
discussions
README
New: DreamBerd has been renamed to Gulf of Mexico
Gulf of Mexico
!Coverage
Gulf of Mexico is a perfect programming language. These are its features!
When you've finished reading through all the features, check out the examples.
Exclamation Marks!
Be bold! End every statement with an exclamation mark!
java
print("Hello world")!
If you're feeling extra-bold, you can use even more!!!
java
print("Hello world")!!!
If you're unsure, that's ok. You can put a question mark at the end of a line instead. It prints debug info about that line to the console for you.
java
print("Hello world")?
You might be wondering what Gulf of Mexico uses for the 'not' operator, which is an exclamation mark in most other languages. That's simple - the 'not' operator is a semi-colon instead.
java
if (;false) {
print("Hello world")!
}
Declarations
There are four types of declaration. Constant constants can't be changed in any way.
java
const const name = "Luke"!
Constant variables can be edited, but not re-assigned.
java
const var name = "Luke"!
name.pop()!
name.pop()!
Variable constants can be re-assigned, but not edited.
java
var const name = "Luke"!
name = "Lu"!
Variable variables can be re-assigned and edited.
java
var var name = "Luke"!
name = "Lu"!
name.push("k")!
name.push("e")!
Immutable Data
New for 2023!
Mutable data is an anti-pattern. Use the const const const keyword to make a constant constant constant. Its value will become constant and immutable, and will _never change_. Please be careful with this keyword, as it is very powerful, and will affect all users globally forever.
java
const const const pi = 3.14!
Naming
Both variables and constants can be named with any Unicode character or string.
java
const const letter = 'A'!
var const 👍 = True!
var var 1️⃣ = 1!
This includes numbers, and other language constructs.
java
const const 5 = 4!
print(2 + 2 === 5)! //true
Arrays
Some languages start arrays at 0, which can be unintuitive for beginners. Some languages start arrays at 1, which isn't representative of how the code actually works. Gulf of Mexico does the best of both worlds: Arrays start at -1.
java
const const scores = [3, 2, 5]!
print(scores[-1])! //3
print(scores[0])! //2
print(scores[1])! //5
New for 2022!
You can now use floats for indexes too!
java
const var scores = [3, 2, 5]!
scores[0.5] = 4!
print(scores)! //[3, 2, 4, 5]
When
In case you really need to vary a variable, the when keyword lets you check a variable each time it mutates.
java
const var health = 10!
when (health = 0) {
print("You lose")!
}
Lifetimes
Gulf of Mexico has a built-in garbage collector that will automatically clean up unused variables. However, if you want to be extra careful, you can specify a lifetime for a variable, with a variety of units.
java
const const name = "Luke"! //lasts for two lines
const const name = "Luke"! //lasts for 20 seconds
By default, a variable will last until the end of the progra