RosettaCodeData/Task/Create-a-two-dimensional-array-at-runtime/Sidef/create-a-two-dimensional-array-at-runtime.sidef

11 lines
292 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
func make_matrix(x, y) {
y.of { x.of(0) };
}
var y = Sys.scanln("rows: ").to_i;
var x = Sys.scanln("cols: ").to_i;
var matrix = make_matrix(x, y); # create the matrix
matrix[y/2][x/2] = 1; # write something inside it
say matrix; # display the matrix