louise
The Louise language: compiler, runtime, std, tooling
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#125 · main · 16 min 13 s
0Étoiles
0Forks
40Issues
| 1 | // A zero divisor in an unboxed-int worker (ADR 0045, Revision 2): the |
| 2 | // worker's division bails to the boxed wrapper, whose recompute panics — |
| 3 | // exactly once, with the boxed path's message. |
| 4 | |
| 5 | import std/io |
| 6 | |
| 7 | fn recip :: n: Int -> Int |
| 8 | { |
| 9 | if n == 0 |
| 10 | { |
| 11 | 100 / n |
| 12 | } |
| 13 | else |
| 14 | { |
| 15 | recip (n - 1) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | pub fn main :: -> () / <io> |
| 20 | { |
| 21 | io.println (show (recip 3)) |
| 22 | } |
| 23 | //! panic: division by zero |