Scripting:Syntax

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
(Created page with "This page describes the syntax of the STNE scripting engine. == Variable declaration == Variables are declared with the code 'Var [VarName] As VarType'. This is best illustrated...")
(Variable declaration)
Line 5: Line 5:
  Var WelcomeMessage As String; // Declares a variable named 'WelcomeMessage' of type String
  Var WelcomeMessage As String; // Declares a variable named 'WelcomeMessage' of type String
  Var DataTable As CTable;      // Declares a variable named 'DataTable' of type CTable
  Var DataTable As CTable;      // Declares a variable named 'DataTable' of type CTable
-
 
+
-
 
+
-
It is also possible to immediately assign a value when declaring variables:
+
/* It is also possible to immediately assign a value when declaring variables */
 +
  Var WelcomeMessage As String = "Hello galaxy!"; // Declares a string and assigns it a value
  Var WelcomeMessage As String = "Hello galaxy!"; // Declares a string and assigns it a value
  Var DataTable      As CTable = New CTable();    // Declares a variable and assigns a newly created CTable to it
  Var DataTable      As CTable = New CTable();    // Declares a variable and assigns a newly created CTable to it
  Var DataTable      As New CTable();            // Also declares a variable and assigns a newly created CTable to it, but with less code
  Var DataTable      As New CTable();            // Also declares a variable and assigns a newly created CTable to it, but with less code

Revision as of 00:58, 15 August 2010

This page describes the syntax of the STNE scripting engine.

Variable declaration

Variables are declared with the code 'Var [VarName] As VarType'. This is best illustrated with a small example:

Var WelcomeMessage As String; // Declares a variable named 'WelcomeMessage' of type String
Var DataTable As CTable;      // Declares a variable named 'DataTable' of type CTable


/* It is also possible to immediately assign a value when declaring variables */

Var WelcomeMessage As String = "Hello galaxy!"; // Declares a string and assigns it a value
Var DataTable      As CTable = New CTable();    // Declares a variable and assigns a newly created CTable to it
Var DataTable      As New CTable();             // Also declares a variable and assigns a newly created CTable to it, but with less code
Personal tools