blob: 369e536bfd790d9e3f04ace2c2c71f1a6302adb3 [file] [log] [blame] [view]
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01001[TOC](Readme.md) [Prev](scopes.md) [Next](aliases.md)
2
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01003_References and Visibility_
4
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# Accessing Fields
6
7Selectors access fields within a struct using the `.` notation.
8This only works if a field name is a valid identifier and it is not computed.
9For other cases one can use the indexing notation.
10
11
12<!-- CUE editor -->
13```
14a: {
15 b: 2
16 "c-e": 5
17}
18v: a.b
19w: a["c-e"]
20```
21
22<!-- result -->
23```
24a: {
25 b: 2
26}
27v: 2
28w: 5
29```