An intbigot program consists of one or more procedures, or PROCs, which can contain VARiables (obviously integers) and statements. All procedures return a value. Procedures do not take arguments; that's why we have dynamic scope, you pansy. The intbigot interpreter will execute the first procedure in your program when you run it.
Let's write our first intbigot program now. Instead of the usual boring "Hello world" example, we will instead use intbigot to tell the world just how cool you are for using intbigot.
# Example 1 - I IS ELEET PROC main { PRINT 1; PRINT 15; PRINT 31337; PRINT NEWLINE; RETURN 0; }
Now, the time may eventually come when you'll want to do something a little more complex with intbigot. Never fear, because intbigot is designed to do the impossible! Let's see an example in which the main procedure calls another procedure, with wacky and hilarious consequences!
# Example 2 - Operation: Print Random Crap PROC main { VAR foo; VAR bar; foo = (1 + 2) * 3 / (5 - 4); bar = showfoo(); PRINT bar; PRINT NEWLINE; RETURN bar; } PROC showfoo { PRINT foo; RETURN 42; }
If you thought the last example was cool, check this one out:
# Example 3 - Behold the miracle of gravity, in all its glory! PROC main { VAR greeting; greeting = 5; hello(); salut(); gooddayeh(); RETURN -82; } PROC hello { VAR greeting; greeting = 2; RETURN greet(); } PROC salut { VAR greeting; greeting = 9563; RETURN greet(); } PROC gooddayeh { RETURN greet(); } PROC greet { PRINT greeting; RETURN greeting; }
Now, you're probably wondering, "Well, this is cool and all, but how do I control the flow of my program? You know, loops and if statements and all that?"
You don't.
This concludes our primer.