TOC

0. Keywords

1. Operators

2. Classes

3. Variables

4. Methods

5. Conditionals

6. Iteration

7. References & Arrays

8. Library

0. Keywords

breakcasecatchclass
constcontinueelsefor
ifnullprivateprotected
publicreturnstaticswitch
thisthrowtrywhile
var

1. Operators

:::,.
===<>
<=>=%%=
**=//=
!!=^^=
&&=&&|
|=++=-
-=--++(
){}[
]'"\
///**/

2. Classes

// Empty class
class MyClass
{
}

// Specialization
class ChildClass : MyClass
{
}

3. Variables

// Class data
class MyClass
{
static var x;
static var y = 1;
}

// Instance data
class ChildClass : MyClass
{
var q = "foo";
var z = 3.14;
}

4. Methods

// static method
class MyClass
{
static var i = 2;

static main()
{
return MyClass::i * MyClass::i;
}
}

//
class ChildClass : MyClass
{

ChildClass(data)
{
MyClass:x = data;
}
}

// C++ Style Declaration
MyClass::volts(i, r)
{

return i * r * r;
}

5. Conditionals

// if
class MyClass
{

static main()
{
var x = 1;
if ( x == 1 )
{
return true;
}
else
{
return false;
}
}

// switch
class MyClass
{

static main()
{
switch ( t )
{
case 1: return true;
case 6: return false;
}
}

6. Iteration

// for
class MyClass
{

static main()
{
var y = 10;
for(var x = 1; x < 10; x++ )
{
y--;
}
return y;
}
}

// while
class MyClass
{

static main()
{
var y = 10;
while(y > 0)
{
y--;
}
return y;
}
}

7. References & Arrays

class MyClass
{

static main()
{
var vec = new Vector();
vec.add(1);
}
}

class MyClass
{

static main()
{
var bar = new Array(10);
bar[7] = 1;
return bar[7];
}
}

8. Library

Array

Array(dim1, dim2, ...)
[index1, index2, ...]
length()
length(index)
Console
readln()
write(val)
writeln(val)
DataTime
DateTime()
static now()
diffms(dtm)
toMilliseconds()
DES
static encrypt(data, password)
static decrypt(data, password)
Hashtable
Hashtable()
put(key, val)
get(key)
clear()
HttpRequest
HttpRequest(url)
get()
Object
static parseInt(val)
static parseFloat(val)
toString()
static toString(val)
static typename(val)
static length(val)
Math
static exp(val)
static rand()
Socket
Socket(port)
accept()
bind()
connect(addr)
close()
error()
listen(buffers)
setBlocking(onoff)
setTimeout(recv, send)
setLingerOn()
setNoDelay()
send(str, len)
recv()
flush()
String
StringBuffer
StringBuffer()
StringBuffer(size)
append(val)
toString()
Vector
Vector()
add(item)
size()
length()
elementAt(index)
[index]
setElementAt(index)
clear()