From 0d5956547ae1affe70835f5b20de9b7b6ec005a7 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 13 Jul 2019 03:06:07 +0000 Subject: [PATCH] updated README.md a bit --- moo/README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/moo/README.md b/moo/README.md index d5b0fb4..e36c69a 100644 --- a/moo/README.md +++ b/moo/README.md @@ -68,6 +68,10 @@ class MyClass(Object) ### Flow Control ~~~ k := if (i < 20) { 30 } else { 40 }. + +if (a < 10) { ... } +elsif (a < 20) { ... } +else { ... }. ~~~ ~~~ @@ -75,10 +79,27 @@ while (true) { }. + +until (a > b) +{ +}. + +do +{ +} while (a > b). + +do +{ +} until (a > b). + +[a > b] whileTrue: [ ... ]. +[a > b] whileFalse: [ ... ]. ~~~ ~~~ 1 to: 20 do: [:count | ... ]. +1 to: 10 by: 3 do: [:count | ... ]. +30 timesRepeat: [ ... ]. ~~~ @@ -92,3 +113,34 @@ ex retry. ex resume. ex resume: value. ex return: value. + +### Type checking + +Type checking not implemented yet. + +~~~ +class SampleClass(Object) +{ + method run => Integer + { + } + + method execute((Integer)a,(Integer)b) => Integer + { + } + + method handle: (Object)this with: (a Integer)care => Integer + { + } +} +~~~ + +TODO: How to specify return type of a block? or How to specify parameter type to a block? + How to evaluate a block type-safely? +~~~ +[ => Integer :(Integer)a :(Integer)b | + + | (Integer)c (Integer)d } + a + b +] with: 20 with: 10 +~~~ \ No newline at end of file