OSDN Git Service

Add: PIONE tutorial about Loop statement. v2.0.2p0098
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 28 Jan 2015 08:20:32 +0000 (17:20 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 28 Jan 2015 08:20:32 +0000 (17:20 +0900)
new file:   SampleCode/PIONE/Basic15/EvenOddLoop4.pione

SampleCode/PIONE/Basic15/EvenOddLoop4.pione [new file with mode: 0644]

diff --git a/SampleCode/PIONE/Basic15/EvenOddLoop4.pione b/SampleCode/PIONE/Basic15/EvenOddLoop4.pione
new file mode 100644 (file)
index 0000000..acdc6e3
--- /dev/null
@@ -0,0 +1,34 @@
+param $maxval := 456
+param $minval := 123
+param $dval := 37
+
+Rule Main
+       output '*.txt'.all
+       $loop := ($maxval - $minval)/$dval
+Flow
+       rule EvenOdd {val: $minval + ($dval * (0.upto($loop))}
+End
+
+Rule EvenOdd
+       output '*.txt'
+       param $val
+Flow
+       if $val % 2 == 0
+               rule Even {val: $val}
+       else
+               rule Odd {val: $val}
+       end
+End
+
+Rule Even
+       output '*.txt'
+       param $val
+Action
+       echo "{$val} is even." >> Even{$val}.txt;
+End
+
+Rule Odd
+       output '*.txt'
+Action
+       echo "{$val} is odd." >> Odd{$val}.txt;
+End
\ No newline at end of file