Basic Syntax
Introduction to Java Script
In SimLab, we use JavaScript as one of the two scripting languages for automation.
Statement
The statements are executed, one by one and use the same written order.
Semicolons separate each statements.
var len_x, len_y, len_z; // Statement 1
len_x = 5; // Statement 2
len_y = 6; // Statement 3
len_z = len_x + len_y; // Statement 4
When separated by semicolons, multiple statements on one line are allowed.
var len_x, len_y, len_z;
len_x = 5; len_y = 6;len_z = len_x + len_y;
Variables
var is the keyword to declare variables.
variables must be declared with unique names.
- Names may contain letters, digits, underscores, and dollar signs and it should start with letter.
- Names are case sensitive (length and Length are different variables) and java script keywords should not be used.
Comments
Single LineStarts with //. To comment a line.
//This is a single line comment.
Starts with /* and end with */. To comment multiple lines.
/* This is a
multi line comment.*/
Data Types
Numbers, Strings are the most used datatypes in SimLab.
var EdgeLength = 20.0; // Number
var GroupName = "Shared_Faces"; // String