OSDN Git Service

Add: PIONE tutorial of Loop statement with upto. v2.0.2p0092
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Thu, 22 Jan 2015 02:03:07 +0000 (11:03 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Thu, 22 Jan 2015 02:03:07 +0000 (11:03 +0900)
new file:   SampleCode/PIONE/Basic15/EvenOddLoop3.pione
new file:   SampleCode/PIONE/Basic15/LoopTouch5.pione
new file:   SampleCode/PIONE/Basic15/LoopTouch6.pione

SampleCode/PIONE/Basic15/EvenOddLoop3.pione [new file with mode: 0644]
SampleCode/PIONE/Basic15/LoopTouch5.pione [new file with mode: 0644]
SampleCode/PIONE/Basic15/LoopTouch6.pione [new file with mode: 0644]

diff --git a/SampleCode/PIONE/Basic15/EvenOddLoop3.pione b/SampleCode/PIONE/Basic15/EvenOddLoop3.pione
new file mode 100644 (file)
index 0000000..a1a874a
--- /dev/null
@@ -0,0 +1,33 @@
+param $maxval := 456
+param $minval := 123
+param $dval := 37
+
+Rule Main
+       output '*.txt'.all
+Flow
+       rule EvenOdd {val: $minval + ($dval * (0.upto(($maxval - $minval)/$dval)))}
+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
diff --git a/SampleCode/PIONE/Basic15/LoopTouch5.pione b/SampleCode/PIONE/Basic15/LoopTouch5.pione
new file mode 100644 (file)
index 0000000..f6a7f6b
--- /dev/null
@@ -0,0 +1,15 @@
+param $min := 0
+param $max := 64
+
+Rule Main
+       output '*.txt'
+Flow
+       rule Test {val: $min.upto($max)}
+End
+
+Rule Test
+       output '{$val}.txt'
+       param $val
+Action
+       touch {$O[1]}
+End
\ No newline at end of file
diff --git a/SampleCode/PIONE/Basic15/LoopTouch6.pione b/SampleCode/PIONE/Basic15/LoopTouch6.pione
new file mode 100644 (file)
index 0000000..84dd040
--- /dev/null
@@ -0,0 +1,15 @@
+param $min := 0
+param $max := 64
+
+Rule Main
+       output '*.txt'
+Flow
+       rule Test {val: $max.downto($min)}
+End
+
+Rule Test
+       output '{$val}.txt'
+       param $val
+Action
+       touch {$O[1]}
+End
\ No newline at end of file