scope: refuse `&x` where x is a local variable
[nit.git] / examples / rosettacode / arrays.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: Arrays
7 # SEE: <http://rosettacode.org/wiki/Arrays>
8 module arrays
9
10 # Creation of an array with a single element
11 var a = [1]
12
13 # Add objects
14 a.add 2
15 a.add_all([3, 4, 5])
16
17 # Set values at a specific index
18 a[0] = 100
19
20 # Get a specific elements
21 print a[0]