diff options
| author | 2024-08-18 23:01:58 +0800 | |
|---|---|---|
| committer | 2024-08-18 23:01:58 +0800 | |
| commit | 8565a173591e4748ac910b4b982dff96bb5dfd60 (patch) | |
| tree | c96409057d2917eaee945e205803d9f9a740a3d5 /dice.orang | |
| parent | Big Refactoring, added support for comments (diff) | |
| download | orang-8565a173591e4748ac910b4b982dff96bb5dfd60.tar.gz orang-8565a173591e4748ac910b4b982dff96bb5dfd60.tar.xz orang-8565a173591e4748ac910b4b982dff96bb5dfd60.zip | |
Added Nothing/empty-tuple arguments
Diffstat (limited to 'dice.orang')
| -rw-r--r-- | dice.orang | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,14 +1,14 @@ | |||
| 1 | def dice sides times = | 1 | def dice sides times = |
| 2 | let once _ = randInt 1 (sides + 1) in | 2 | let once () = randInt 1 (sides + 1) in |
| 3 | let aux acc times = | 3 | let aux acc times = |
| 4 | if times ?= 0 then acc | 4 | if times ?= 0 then acc |
| 5 | else aux (acc + once ()) (times - 1) | 5 | else aux (acc + once ()) (times - 1) |
| 6 | in | 6 | in |
| 7 | aux 0 times | 7 | aux 0 times |
| 8 | 8 | ||
| 9 | def guessing_game _ = | 9 | def guessing_game () = |
| 10 | let secret = randInt 1 101 | 10 | let secret = randInt 1 101 |
| 11 | and guessOnce _ = do | 11 | and guessOnce () = do |
| 12 | print "Make your guess: "; | 12 | print "Make your guess: "; |
| 13 | let guess = readInt () in | 13 | let guess = readInt () in |
| 14 | if secret > guess then do | 14 | if secret > guess then do |