root/trunk/samples/arrays.md

Revision 361, 489 bytes (checked in by JarrettBillingsley, 3 months ago)

MDCL is (mostly) working! Wee!

Also fixed a bug with ~=.

Line 
1 module samples.arrays
2
3 function test()
4 {
5     local l1 = array.range(100000)
6     local l2 = l1.dup()
7     local l3 = []
8
9     l2.reverse()
10
11     while(#l2 > 0)
12         l3 ~= l2.pop()
13
14     while(#l3 > 0)
15         l2 ~= l3.pop()
16
17     l1.reverse()
18
19     for(i : 0 .. #l1)
20         if(l1[i] != l2[i])
21             return false
22
23     return #l1
24 }
25
26 function main(N)
27 {
28     local n = 1
29
30     if(isString(N))
31         n = toInt(N)
32
33     for(i : 0 .. n)
34     {
35         if(!test())
36         {
37             writefln("failed")
38             return
39         }
40     }
41
42     writefln("oki doki")
43 }
Note: See TracBrowser for help on using the browser.