tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

15 lignes · 430 octetsBrut · Historique
1// `array.set` out of range stops the actor, on both backends; the native
2// runtime releases the array and the value it was given.
3
4import std/array
5import std/io
6
7pub fn main :: -> () / <io>
8{
9 let a = array.from_list ["x", "y", "z"]
10 io.println (show (array.set a 2 "w"))
11 let b = array.set a 3 "never stored"
12 io.println ("never printed " <> show b)
13}
14//> [x, y, w]
15//! panic: array.set: index 3 out of range for length 3