Simkin Data Types


These are the Simkin data types:

TypeDescriptionExample
selfa reference to the object owning the scriptself.field="Hello";
booleana truth valuetrue or false
integera signed number32
floata signed floating point number32.33
charactera single character.Use "\" to quote characters'm', '\''
stringan arbitrary length piece of text.You can embed any text except ".To use " put a slash and then a quote \"."He said \"Goodbye\" and left."
objectanother Simkin object with methods and fieldsMyObject
XML elementan XML element object<element><subelement>Value1</subelement></element>
TreeNodea TreeNode Object
 label [data] 
 {
  child_label [child_data]
 }

There are some built-in functions which are used with these types:

Variables are used without declarations.

The type of a variable is implied by its value, and Simkin will convert to different types as required.

The chart below indicates how this happens:

Type Conversions

From/Tointegerfloatbooleanstringcharacter
integern/a1 becomes 1.00 becomes false
all other values are true
1 becomes "1"converts to character code
floatrounded downn/a0.0 becomes false
all other values are true
1.0 becomes "1.0"converts to character code
booleantrue becomes 1
false becomes 0
true becomes 1.0
false becomes 0.0
n/atrue becomes "true"
false becomes "false"
true becomes 't', false becomes 'f'
string"1" becomes 1, "abc" becomes 0"1" becomes 1.0, "abc" becomes 0.0"true" becomes true
"false" or other values becomes false
n/afirst character is taken "abc" becomes 'a'
characterconverts to character codeconverts to character code't' becomes true 'f' or other values false'a' becomes "a"n/a
XML Element<foo>4</foo> becomes 4<foo>4</foo> becomes 4.0<foo>true</foo> becomes true<foo>hello</foo> becomes "hello"<foo>h</foo> becomes 'h'
TreeNodelabel [4] becomes 4label [4] becomes 4.0label [true] becomes truelabel [hello] becomes "hello"label [h] becomes 'h'

For example:

name="Simon";
value=4;
trace(name+value);
will produce:
4
and
trace(name # value);
will produce
Simon4