Basic Syntax

As a C-like scripting language, vc has certain syntax rules that need to be adhered to. For veteran coders, much of this will be old-hat.

First off, the semicolon is analguous to a period in english. It denotes the end of a statement. Whenever you declare a variable, set a variable, or call a statement, you need to end the line with a semicolon, like so:

int answer;

answer = 42;

Ponder();

Curly braces are also prevalent, acting as bookends between a block of code. Whenever using conditionals or defining a function, you will be using curly braces to delimit the boundaries of the conditional or function, like so:

void Ponder() 
{
    if(answer == 42) 
    {
        Exit("Ah, yes... but what was the question?");
    }
}

Notice how every time a curly brace was opened, the code was tabbed in one level, and when the curly brace was closed, the code went back up a level of indentation. This is not strictly necessary, but a very good habit to get into to make your code more readable to others... which is an exceptionally good thing if you want help debugging your program from others. ;)

Another thing to note, is that VC is case-insensitive. This means that capitalization of variables, functions, and keywords is not important, only their spelling. The only exception to the rule are #defines, which match exact text. Here is an example of the case-insensitivity in work:

Int MonsterLegs = 8;
monsterLEGS--;
IF(monsterlegs == 7)
{
    exit("Sad octopus.");
}

It is strongly recommended you try and stick with one style of capitalization though, to keep your code from becoming too messy. Some people like to stick to the way things are written in the docs, others like lowercase, others like camelCased (or CamelCased) spelling.

The rest of the syntax will be covered in their specific sections. A whole plethora of odd words and symbols awaits the novice programmer. You can find premade syntax highlighting files for text editors in the Downloads Section. It's strongly suggested you get one (For Windows: Textpad, Notepad++, Programmer's Notepad. For Mac: TextWrangler. For Linux: gedit. Of course, there are others). People would be lost in a sea of bland symbols ourselves without syntax highlighting, you surely shouldn't go it without, if you can help yourself.

Talkback

Post a new comment?

Talkback #1 written by Overkill on 2004-06-05.

Verge's language is also similar to C in many ways. Every "statement" must end with a semi-colon ; . This is important. Example: number_of_friends=0; Braces are also very important { } . You'll need braces for control structures and functions to work. All codes in VergeC are put in ".VC" files. You must have "System.VC" in order to compile things. You must also have a function named Autoexec for VERGE to actually do something. void AutoExec() { exit("Hello world!"); }

Post a new comment?

Doc Nav

Your docs
View All Docs

If you log in, you can edit the documentation, or create your own documents and tutorials!

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.