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

12 lines
208 B
Plaintext
Raw Normal View History

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