Create a two-dimensional array at runtime: Difference between revisions

(Added Easylang)
Line 2,409:
=={{header|Objeck}}==
<syntaxhighlight lang="objeck">
class TwoDimArray {
use IO;
function : Main(args : System.String[]) ~ Nil {
rows := Standard->ReadLine()->ToInt();
cols := Standard->ReadLine()->ToInt();
 
array : Int[,] := IntFloat->New[xrows, ycols];
bundle Default {
array[0, 0] := 242.0;
class TwoDee {
}
function : Main(args : System.String[]) ~ Nil {
Standard->Print("The number at place: ")->PrintLine(array[0,0]);
DoIt();
}
function : native : DoIt() ~ Nil {
Console->GetInstance()->Print("Enter x: ");
x := Console->GetInstance()->ReadString()->ToInt();
Console->GetInstance()->Print("Enter y: ");
y := Console->GetInstance()->ReadString()->ToInt();
if(x > 0 & y > 0) {
array : Int[,] := Int->New[x, y];
array[0, 0] := 2;
array[0, 0]->PrintLine();
};
}
}
}
760

edits