These are the Simkin data types:
| Type | Description | Example |
|---|---|---|
| self | a reference to the object owning the script | self.field="Hello"; |
| boolean | a truth value | true or false |
| integer | a signed number | 32 |
| float | a signed floating point number | 32.33 |
| character | a single character.Use "\" to quote characters | 'm', '\'' |
| string | an 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." |
| object | another Simkin object with methods and fields | MyObject |
| XML element | an XML element object | <element><subelement>Value1</subelement></element> |
| TreeNode | a 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:
| From/To | integer | float | boolean | string | character |
|---|---|---|---|---|---|
| integer | n/a | 1 becomes 1.0 | 0 becomes false all other values are true | 1 becomes "1" | converts to character code |
| float | rounded down | n/a | 0.0 becomes false all other values are true | 1.0 becomes "1.0" | converts to character code |
| boolean | true becomes 1 false becomes 0 | true becomes 1.0 false becomes 0.0 | n/a | true 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/a | first character is taken "abc" becomes 'a' |
| character | converts to character code | converts 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' |
| TreeNode | label [4] becomes 4 | label [4] becomes 4.0 | label [true] becomes true | label [hello] becomes "hello" | label [h] becomes 'h' |
For example:
name="Simon"; value=4; trace(name+value);will produce:
4and
trace(name # value);will produce
Simon4