SimTalk 2.0 and SimTalk 1.0 Compared

The following table provides an overview of the changed language constructs between SimTalk 2.0 and SimTalk 1.0.

Feature

New Syntax (SimTalk 2.0)

Old Syntax (SimTalk 1.0)

Parameter Declaration

param v1,v2: integer, name: string

(v1,v2:integer; name:string)

Return Type Declaration

->boolean

or

param v1,v2: integer, name: string -> boolean

:boolean

or

(v1,v2:integer; name:string): boolean

Empty Method

is
do
end; 

Variable Declaration between is and do

var v: integer
var s: string 
is
   v:integer;
   s:string;
do
end; 

Variable Declaration

var s: string

local s: string

if condition

if a > 3
   print a
end
if a > 3 then
   print a;
end;

for loop

for var i := 1 to 10
   print i
next 
for local i := 1 to 10 loop
   print i;
next;

while loop

while a  10
   a += 1
   print a
end 
while a  10 loop
   a := a + 1;
   print a;
end; 

repeat loop

repeat
   a += 1
   print a
until a > 10 
repeat
   a := a + 1;
   print a;
until a > 10; 

switch-statement

switch a
   case 1
      print 1
   case 2
      print 2
end  
inspect a
   when 1 then
      print 1;
   when 2 then
      print 2;
end; 

waituntil-statement

waituntil name = "Test"

or

waituntil name = "Test" prio 1

waituntil name = "Test" prio 1;

DataList operator [ ]

Cardfile.remove(2)

Cardfile[2]

The following table provides an overview of the changed operators between SimTalk 2.0 and SimTalk 1.0.

Feature

New Syntax (SimTalk 2.0)

Old Syntax (SimTalk 1.0)

About equal operator

~=

<~=

>~=

==

<==

>==

Add a value

Subtract a value

Multiply a value

x += y is short for x := x + y

x -= y is short for x := x - y

x *= y is short for x := x * y

Modulo operator

mod

\\

Division operator

div

//

Reference operator

&

e.g. .Models.Frame.&Method

.ref()

e.g. .ref(.Models.Frame.Method)

Type check during assignment

Wrong unit causes an error. To prevent this, assign the correct unit or a value without a unit, for example:

Conveyor.Speed := Conveyor.Length / 0:01

Wrong unit causes an warning, for example:

Conveyor.Speed := Conveyor.Length

You can activate SimTalk 2.0 notation by clicking New Syntax on the Tools ribbon tab of the Method you are programming. If you want to use if for all new Methods which you are going to program, activate New Syntax in the Method class in the Class Library. Instead, you can also use the attribute UsingNewSyntax.

Note:

Clicking in an existing Method which you programmed in SimTalk 1.0 notation automatically converts the source code to the correct SimTalk 2.0 notation.