User:Masfétus/Pawn (language)

PAWN (formerly known as Small-C) is a programming language used by different platforms and based on C language.

Applications
Many of embedded systems — such as the ESTCube-1 satellite and video-game servers (SA-MP mostly) — were developed with the PAWN language because of its low resource use.

Eternal Lands was also developed with the Small language.

Elements of PAWN
As a programming language, PAWN has its own language specific features.

Variables
The declaration and typing of variables is different than C language. Indeed, the 'new' keyword is required and a typing can follow it.

Variables are automatically declared as integers without typing it. Initializing variables is recommended even though they store a default value.

Conditional statements
In PAWN there are two main statements: "if" and "switch".

Statement "if"
This statement checks a boolean expression into the brackets.

There are many ways to manage a conditional statement. First of those: However, instructions can also be executed in case of a logical condition denial thanks to the "else" keyword. The previous statements can be nested into another statement called by the "else if" keyword. Note: Using the "else" in the end of a conditional statement checks if the previous conditions have not been verified.

Statement "switch"
The "switch" statement is used for a situation where consecutively checking a variable value is necessary.

It can refer to a sequence of "if" statement followed by "else / if" statements.

Looping statements
A looping statement is used to repeat instructions a number of times.

Two different statements are used, depending on whether the number of repetitions is known.

Loop "for"
The "for" loop executes the instructions inside the statement a certain amount of times (which is known).

It is also called deterministic loop.

An increment is often used in this kind of loops in order to count how many iterations have been executed.

Loop "while"
The while loop is conversely a non-deterministic loop.

A condition leads the number of iterations and do not allow us to know this number. The program is executed as long as the condition is fulfilled.

In this kind of loop, an increment is not absolutely required to perform correctly.

Category:Programming languages Category:Pages with unreviewed translations