nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
contrib/nitrpg: use stats to store player nitcoins
[nit.git]
/
examples
/
procedural_array.nit
diff --git
a/examples/procedural_array.nit
b/examples/procedural_array.nit
index
6d31fc2
..
838bda0
100644
(file)
--- a/
examples/procedural_array.nit
+++ b/
examples/procedural_array.nit
@@
-16,11
+16,11
@@
# A procedural program (without explicit class definition).
# This program manipulates arrays of integers.
# A procedural program (without explicit class definition).
# This program manipulates arrays of integers.
-package procedural_array
+module procedural_array
# The sum of the elements of `a'.
# Uses a 'for' control structure.
# The sum of the elements of `a'.
# Uses a 'for' control structure.
-meth array_sum(a: Array[Int]): Int
+fun array_sum(a: Array[Int]): Int
do
var sum = 0
for i in a do
do
var sum = 0
for i in a do
@@
-31,7
+31,7
@@
end
# The sum of the elements of `a' (alternative version).
# Uses a 'while' control structure.
# The sum of the elements of `a' (alternative version).
# Uses a 'while' control structure.
-meth array_sum_alt(a: Array[Int]): Int
+fun array_sum_alt(a: Array[Int]): Int
do
var sum = 0
var i = 0
do
var sum = 0
var i = 0