From 2de127f045f76d1a9bb0805fa574aef1667a825d Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 17 May 2020 16:01:02 +0200 Subject: [PATCH] docs: structs: more info on default field values --- doc/docs.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 02fe0ba030..096308654b 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -655,12 +655,16 @@ button.widget.set_pos(x,y) ```v struct Foo { - n int // n is 0 by default + n int // n is 0 by default + s string // s is '' by default + a []int // a is `[]int{}` by default pos int = -1 // custom default value } ``` -All struct fields are zeroed by default during the creation of the struct. But it's also possible to define custom default values. +All struct fields are zeroed by default during the creation of the struct. Array and map fields are allocated. + +It's also possible to define custom default values. ## Access modifiers