Data Types

Silk is a dynamically typed language, and the type is determined at runtime. so you do not need to declare the type of a variable, a variable is created the moment you first assign a value to it..
nCount=1;
dMile=100.68;
strName="Wang Gang";


There are 8 data types in Silk:
Integer
n=10;

Integer is a whole number, positive or negative, without decimals
In 32 bit Silk,the value range is from -2147483648 to 2147483647. 
In 64 bit Silk,the value range is from -9223372036854775808 to 9223372036854775807. 
You can convert the variable with other types into integer by using built-in function _int:
n=_int("12"); 
m=_int(12.36);


Float
mile=200.56;

Float is "floating point number", it is a number, positive or negative, containing one or more decimals. The storage size is 8 bytes and the value range is from 2.3E-308 to 1.7E+308
You can convert the variable with other types into integer by using built-in function _float:
 x=_float("12.36");


String
name="Wang";

String is surrounded by double quotation marks. Escape characters such as '\n' are supported within string.

Array
names=["Wang","Zhang","Li"];
array2=[1,"abc",200.23,names,{"Zhao":50}];
print(names[1]);

An array is used to store a collection of data, and can be accessed by the index of the element.  Unlike C, Silk supports different data type in array. We can store Integer, Float, String, Array and Dictionary in a single array.

Dictionary
names=["Wang","Zhang","Li"];
dicts={"Wang":25,"Zhang":30,"Li":[10,20],"Others":names};
print(dicts["Zhang"]);

Dictionary is used to store data values in key:value pairs. It is written with curly brackets, and the key does not allow duplicates. Silk supports different data type in dictionary. We can store Integer, Float, String, Array and Dictionary in a single dictionary.

Boolean
In Silk, Boolean is actually the Integer 1 and 0, we can use true and false instead of 1 and 0.

Handle
A handle is sort of a pointer, and it allows you to keep a reference to an object, rather than the object itself.  If you open a file or load a Dll, the return value is a handle, and you can control the file/dll with the handle.
lib=_loadlib(get_curdir()+"sqlitedll64.dll");
print(_type(lib));


Null
In Silk, we have a special value 'null', null is not the same as 0, false, or an empty string. it means nothing and only null can be null.
n=null;