The basic syntax of Nzym is very simple. Objects are created by assigning a value to a variable of the appropriate type. For example, to create a new object of type Number, you would write the following:

Number myInteger = 10;

Methods are called on objects by using the dot notation. For example, to call the Add method on an object of type Number, you would write the following:

myInteger.Add =6;
// If the value of myInteger was equal to 10 before, it will now be 16

It is also important to note that the semicolon (;) is used to terminate all statements and a comment is created by using two forward slashes (//) and usually a space after.

Primitive Types 

Nzym introduces just five basic primitive types:
  • Number – will store integers, floats or a mix of the two
  • String – stores characters and can be used for more complex expressions
  • Boolean – a binary type storing true or false
  • Group – an array of objects, used to create and define more complex elements
  • Link – a unique type that can be void or that directs to a function

Classes & Methods 

Nzym Classes can be used to create custom types. Each script file in a project can be called and accessed as a class, however, within a script file, other classes can be created. Nzym also has a unique take on methods. There are two types of Methods in terms of how they are created and this is based on where they are created. Those that are contained in nested classes are simply referred to as Methods. The ones outside a class are referred to as Functions. The following code gives an example of the two:


Class Person;
String name= No Name;
Number age = 18;
Method ShowName;
Raw name;
Return;
Return;

Function GetPerson = String;
Person randomPerson;
randomPerson.name = A Stranger;
randomPerson.ShowName;
Return;

The code above creates a Class called Person and instantiates the properties of name and age, setting them up with default variables. Also in Person is a method which will print out the name of the given Person Class. The function GetPerson has a return type of String and actually creates a new Person and prints their name to the screen given the method from the Person class.


Inheritance 

Nzym classes can inherit from other classes. This allows you to reuse code and create more complex types. To inherit from a class, you would use the equals sign after creating the class, for example, the following class inherits from the Person class:

Class SuperHero = Person;
Group superpowers = (Laser eyes, Super strength, Flight);
Number activePower = 1;
Method PowerInUse;
Raw superpowers[activePower];
Return
Return;

The SuperHero class will have access to all the properties and methods of the Person class, as well.

[add]