Variable Declarations

From Pointui

Variables can be declared at any point during a method. For instance the following is valid:

void Method1()
{
	int i;
	//do something with i
	//…
 
	//declare another var
	String s;
	s = i;
}

This applies to property definitions within classes as well – they can be declared at any point during the class:

class A
{
	int Property1;
 
	void Method1() {}
	void Method2() {}
 
	int Property2;
 
	void Method3() {}
}

Multiple variables can be declared in the single statement:

int i1, i2, i3, i4;

However, initializers are currently only supported for the variables declared within methods (class property initializers are not supported):

class Example
{
	//not supported
	int a = 3;
 
	//supported
	int a;
 
	void Load()
	{
		//supported
		int i = 1, j = 5;
	}
}