tobogganSe connecter

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.

23 lignes · 397 octetsBrut · Historique
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
5import std/io
6
7fn recip :: n: Int -> Int
8{
9 if n == 0
10 {
11 100 / n
12 }
13 else
14 {
15 recip (n - 1)
16 }
17}
18
19pub fn main :: -> () / <io>
20{
21 io.println (show (recip 3))
22}
23//! panic: division by zero