summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Examples/example10.se
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/Examples/example10.se')
-rw-r--r--Sencha-lang/Examples/example10.se46
1 files changed, 46 insertions, 0 deletions
diff --git a/Sencha-lang/Examples/example10.se b/Sencha-lang/Examples/example10.se
new file mode 100644
index 0000000..5037051
--- /dev/null
+++ b/Sencha-lang/Examples/example10.se
@@ -0,0 +1,46 @@
+array data[4];
+data[0] = 122;
+data[1] = 3;
+data[2] = -6;
+data[4] = 55;
+
+#this array is a mess, let's sort it!
+def print_array(array)
+{
+ i = 0;
+ while(i < len(array))
+ {
+ print(array[i], " ");
+ i = i + 1;
+ }
+ print("\n");
+}
+
+print_array(data);
+
+#as for now - it won't work
+#I can't pass arrays to functions
+#heh
+
+def sort(data)
+{
+ i = 0;
+ while(i < len(data))
+ {
+ j = 0;
+ while(j < len(data) - 1)
+ {
+ if(data[j] > data[j + 1])
+ {
+ temp = data[j + 1];
+ data[j + 1] = data[j];
+ data[j] = data[j + 1];
+ }
+ j = j + 1;
+ }
+ i = i + 1;
+ }
+ return data;
+}
+
+sort(data);