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.

13 lignes · 357 octetsBrut · Historique
1// `result.expect` on an `Error` panics with the message and the reason.
2
3import std/io
4import std/result
5import std/string
6
7pub fn main :: -> () / <io>
8{
9 io.println (show (result.expect (string.to_int "12") "a literal"))
10 io.println (show (result.expect (string.to_int "twelve") "a literal"))
11}
12//> 12
13//! panic: a literal: "not an integer: \"twelve\""