Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
13
Task/Arrays/Pony/arrays.pony
Normal file
13
Task/Arrays/Pony/arrays.pony
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
var numbers = Array[I32](16) // creating array of 32-bit ints with initial allocation for 16 elements
|
||||
numbers.push(10) // add value 10 to the end of array, extending the underlying memory if needed
|
||||
try
|
||||
let x = numbers(0) // fetch the first element of array. index starts at 0
|
||||
Fact(x == 10) // try block is needed, because both lines inside it can throw exception
|
||||
end
|
||||
|
||||
var other: Array[U64] = [10, 20, 30] // array literal
|
||||
let s = other.size() // return the number of elements in array
|
||||
try
|
||||
Fact(s == 3) // size of array 'other' is 3
|
||||
other(1) = 40 // 'other' now is [10, 40, 30]
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue