I found a little bug with the latest (2.8.1) when writing a class in AS; I think it deals with the compiler:
Basically, when you are declaring two of the same variable type seperated by a comma, it thinks there should be a semicolon. For example, The following code will compile fine:
class Vec2
{
float x;
float y;
}
However, this code will not compile and gives a "expected ';'" error:
class Vec2
{
float x,y;
}
I tested using the comma outside a class declaration and it works fine
---------question about arrays---------
I was messing around with the arrays, and i wanted to test if it could do 2 dimensional arrays, so i wrote:
void main()
{
float[][] arr = { {10, 11, 12}, {13, 14, 15} };
for (int i=0;i<arr.length();i++)
{
for (int j=0;j<arr[0].length();j++)
{
print("" + arr[j] + " ");
}
println("");
}
}
//print and println, btw, are functions I had registered from c++
And interstingly enough, it gave me a couple errors, regarding the for loops, but ran just as you would expect afterwards, printing out the numbers just right
Heres the errors it game me:
Error at Line 5, Position 16
Signed/Unsigned mismatch
Error at Line 7, Position 17
Signed/Unsigned mismatch
I also noted that no matter how many ways i tried, i couldnt seem to declare a 2d array without initializing it first, so something like:
float[][] arr(3,2);
would always give me an error..
So anyways, my questions are, what is the proper way to code those for loops so that i dont get the error, and is there a way to declare an empty 2d array?