v icon indicating copy to clipboard operation
v copied to clipboard

map: declaration can't be done during initialization

Open Bowero opened this issue 7 years ago • 1 comments

V version: v 0.1.18 OS: (Arch) Linux

The problem

mut m := map[string]f32
m = {
        'one': 1.0,
        'one & a half': 1.5,
        'two': 2.0
}

This code works perfectly fine. This however, does not:

m := {
        'one': 1.0,
        'one & a half': 1.5,
        'two': 2.0
}

Apparantly, you can only declare a map after initializing it. This is not the case for a map of type map[string]int however. That makes it unexpected behaviour.

Bowero avatar Aug 26 '19 12:08 Bowero

This has been resolved by #1753, thank you @Danil-Lapirow! :1st_place_medal:

Bowero avatar Aug 26 '19 18:08 Bowero