Introduction to S-Lang

20 downloads 364 Views 117KB Size Report
Binary and Unary Operators. Variables. Conditional and Looping Statements. Functions. Working with Arrays. Examples. Introduction to S-Lang – p.2/24 ...
Introduction to S-Lang John E. Davis [email protected]

MIT/CXC

Introduction to S-Lang – p.1/24

Outline Basic Data Types Binary and Unary Operators Variables Conditional and Looping Statements Functions Working with Arrays Examples

Introduction to S-Lang – p.2/24

Basic Data Types Signed and unsigned versions char, short, int, and long integer types Single and double precision floating point types A double precision complex type Strings User-defined Structures Multi-dimensional Arrays Associative Arrays (hashes)

Introduction to S-Lang – p.3/24

Binary Operators Arithmetic Operators:

+, -, *, /, ˆ, mod

Relational Operators:

>, >=, cos(x)) x = x + PI/4; else if (x < tan (x)) x = x - PI/3; else x = y;

Introduction to S-Lang – p.6/24

Looping Constructs Execute the do_something function 10 times.

for (i=0; i