• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revisiond534238553ba3a4e56728eb0ee67ca1e96df5161 (tree)
Time2015-01-13 10:11:41
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: PIONE tuotial for Loop Statement.
new file: SampleCode/PIONE/Basic11/EvenOddLoop2.pione
modified: SampleCode/PIONE/Basic11/LoopTouch.pione
modified: SampleCode/PIONE/Basic11/LoopTouch2.pione

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE/Basic11/EvenOddLoop2.pione
@@ -0,0 +1,48 @@
1+param $maxval := 456
2+param $minval := 123
3+param $dval := 37
4+
5+Rule Main
6+ output '*.txt'.all
7+Flow
8+ rule LoopSystem {val: $minval}
9+End
10+
11+Rule LoopSystem
12+ output '*.txt'.all
13+ param $val
14+Flow
15+ if $val <= $maxval
16+ rule EvenOdd {val: $val}
17+ end
18+ if (($val * 2) - $minval) + $dval <= $maxval
19+ rule LoopSystem {val: (($val * 2) - $minval) + $dval}
20+ end
21+ if (($val * 2) - $minval) + ($dval * 2) <= $maxval
22+ rule LoopSystem {val: (($val * 2) - $minval) + ($dval * 2)}
23+ end
24+End
25+
26+Rule EvenOdd
27+ output '*.txt'
28+ param $val
29+Flow
30+ if $val % 2 == 0
31+ rule Even {val: $val}
32+ else
33+ rule Odd {val: $val}
34+ end
35+End
36+
37+Rule Even
38+ output '*.txt'
39+ param $val
40+Action
41+ echo "{$val} is even." >> Even{$val}.txt;
42+End
43+
44+Rule Odd
45+ output '*.txt'
46+Action
47+ echo "{$val} is odd." >> Odd{$val}.txt;
48+End
\ No newline at end of file
--- a/SampleCode/PIONE/Basic11/LoopTouch.pione
+++ b/SampleCode/PIONE/Basic11/LoopTouch.pione
@@ -11,7 +11,7 @@ Rule LoopSystem
1111 param $val
1212 Flow
1313 rule Test {val: $val}
14- if ($val + 1) <= $max
14+ if $val + 1 <= $max
1515 rule LoopSystem {val: $val + 1}
1616 end
1717 End
--- a/SampleCode/PIONE/Basic11/LoopTouch2.pione
+++ b/SampleCode/PIONE/Basic11/LoopTouch2.pione
@@ -11,10 +11,10 @@ Rule LoopSystem
1111 param $val
1212 Flow
1313 rule Test {val: $val}
14- if (($val * 2) + 1) <= $max
14+ if ($val * 2) + 1 <= $max
1515 rule LoopSystem {val: ($val * 2) + 1}
1616 end
17- if (($val * 2) + 2) <= $max
17+ if ($val * 2) + 2 <= $max
1818 rule LoopSystem {val: ($val * 2) + 2}
1919 end
2020 End
Show on old repository browser