Basic Syntax

Program starts from "mainfunc" function first. We will learn better in functions section. When you open Classes/MainClass.a file after creating project,

mainfunc() print("Hello");

You will see code. This means that when program runs, "Hello" is written on screen. ";" means code is finished.

mainfunc() print("Hello"); print("Hello");

You will get an error when you run code. If you write single code inside functions, you can write them without curly braces. However, when you write more than 1 code, you must enclose it in curly brackets. Well:

mainfunc() {print("Hello"); print("Hello");}

If you run code, 2 hello will be written on screen. Spacing between codes in A language is trivial. Well:

mainfunc(){

print("Hello");

print("Hello");

}

Code is same as previous code.

Notes can be written between codes. Comment lines are used for this. Comment lines are used to explain code and make it more readable. What is written inside comment lines is not compiled by compiler. So it has no effect on program. Example:

//program has started.

mainfunc(){

print("Hello"); //Hello printed.

print("Hello"); //Hello printed.

}

/*

"Hello" is printed 2 times in program.

*/

There are 2 types of comment lines, single-line and multi-line. Single-line comments start with // and end with a newline. Multiline comments begin with /* and end with */.

A language is case sensitive. For example, if Mainfunc is written instead of mainfunc, program will not run.

In A language, classes begin with a capital letter, functions and data types begin with a lower case letter or "_".

Keywords in A language are used while written codes are compiled into desired software language. Therefore, they cannot be used as variable or object names. It may cause errors if used.

Example: print