v/vlib/compiler/tests/repl/immutable_len_fields/fields.2.repl

12 lines
196 B
Plaintext
Raw Normal View History

mut a := []string
a.len = 0 // Error (field len immutable)
'BYE'
===output===
cannot modify immutable field `len` (type `array`)
declare the field with `mut:`
struct array {
mut:
len int
}
BYE