• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revisionc78c4336fd3795d59ff1b4384bcc5affbe2b43c3 (tree)
Time2015-01-22 11:03:07
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: PIONE tutorial of Loop statement with upto.
new file: SampleCode/PIONE/Basic15/EvenOddLoop3.pione
new file: SampleCode/PIONE/Basic15/LoopTouch5.pione
new file: SampleCode/PIONE/Basic15/LoopTouch6.pione

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE/Basic15/EvenOddLoop3.pione
@@ -0,0 +1,33 @@
1+param $maxval := 456
2+param $minval := 123
3+param $dval := 37
4+
5+Rule Main
6+ output '*.txt'.all
7+Flow
8+ rule EvenOdd {val: $minval + ($dval * (0.upto(($maxval - $minval)/$dval)))}
9+End
10+
11+Rule EvenOdd
12+ output '*.txt'
13+ param $val
14+Flow
15+ if $val % 2 == 0
16+ rule Even {val: $val}
17+ else
18+ rule Odd {val: $val}
19+ end
20+End
21+
22+Rule Even
23+ output '*.txt'
24+ param $val
25+Action
26+ echo "{$val} is even." >> Even{$val}.txt;
27+End
28+
29+Rule Odd
30+ output '*.txt'
31+Action
32+ echo "{$val} is odd." >> Odd{$val}.txt;
33+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic15/LoopTouch5.pione
@@ -0,0 +1,15 @@
1+param $min := 0
2+param $max := 64
3+
4+Rule Main
5+ output '*.txt'
6+Flow
7+ rule Test {val: $min.upto($max)}
8+End
9+
10+Rule Test
11+ output '{$val}.txt'
12+ param $val
13+Action
14+ touch {$O[1]}
15+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic15/LoopTouch6.pione
@@ -0,0 +1,15 @@
1+param $min := 0
2+param $max := 64
3+
4+Rule Main
5+ output '*.txt'
6+Flow
7+ rule Test {val: $max.downto($min)}
8+End
9+
10+Rule Test
11+ output '{$val}.txt'
12+ param $val
13+Action
14+ touch {$O[1]}
15+End
\ No newline at end of file
Show on old repository browser