Variables And Types; Operators - Keithley 3700 series Reference Manual

System switch/multimeter
Hide thumbs Also See for 3700 series:
Table of Contents

Advertisement

Section 2: TSP Programming Fundamentals

Variables and types

TSL has six basic types; nil, boolean, number, string, function, and table. TSL is a dynamically
typed language, which means variables do not need to be declared as a specific type. Instead,
variables assume a type when a value is assigned to them. Therefore, each value carries its
own type. If a variable has not been assigned a value, the variable defaults to the type nil. All
numbers are real numbers. There is no distinction between integers and floating-point numbers
in TSL.
var = nil
var = 1.0
var = 0.3E-12
var = 7
var = "Hello world!"
var = "I said, Hello world!"
var = function(a, b) return(a+b) end
var = {1, 2., 3.00e0}
Nil is a type with a single value, nil, whose main property is to be different from any other value.
Global variables have a nil value by default—before a first assignment—and you can assign nil
to a global variable to delete it. TSL uses nil as a kind of non-value to represent the absence of
a useful value.

Operators

Arithmetic operators:
+ ............................................................................................................ (addition)
- ........................................................................................................ (subtraction)
*..................................................................................................... (multiplication)
/ ............................................................................................................. (division)
- ............................................................................................................(negation)
Relational operators:
< .......................................................................................................... (less than)
> ..................................................................................................... (greater than)
<= .......................................................................................... (less than or equal)
>= ...................................................................................... (greater than or equal)
2-24
Series 3700 System Switch/Multimeter Reference Manual
var is nil.
var is now a number.
var is still a number.
var is still a number.
var is now a string.
var is still a string.
var is now a function that adds two
numbers.
var is now a table (in other words, an
array) with three initialized members.
Document Number: 3700S-901-01 Rev. A / August 2007

Advertisement

Table of Contents
loading

Table of Contents