From: Doni Pracner Date: Thu, 12 Jun 2014 14:17:54 +0000 (+0200) Subject: new sample - fields X-Git-Tag: v0.1.8~1^2~13 X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=e19d91ebbcdedfaecabcc531ce2abe0fab9c5efc;p=mjc2wsl.git new sample - fields --- diff --git a/samples/fields.mj b/samples/fields.mj new file mode 100644 index 0000000..f29fb26 --- /dev/null +++ b/samples/fields.mj @@ -0,0 +1,44 @@ +program F + class HolderClass { + int simple; + int[] arry; + } + + HolderClass holder; + +{ + void main() + int i, size; + { + holder = new HolderClass; + holder.simple = 5; + + print(holder.simple,10); + + print(chr(10)); + + size = 5; + holder.arry = new int[size]; + holder.arry[0] = size+1; + i = 1; + while (i < size){ + holder.arry[i] = holder.arry[i-1]-1; + i++; + } + + i = 0; + while (i < size){ + print(holder.arry[i],3); + i++; + } + print(chr(10)); + + i = 0; + while (i < size){ + holder.arry[i]--; + print(holder.arry[i],3); + i++; + } + + } +} \ No newline at end of file