title: How to use a variable to refer to a key of a struct?
body: <p>How can I use a variable to access a field of a struct:</p>
  
  <pre><code>  var1 = "key1"
    struct1 = %MyStruct{key1: "fdsfd", key2: 33}
  
    val1 = struct1[:????] # how to use var1 for "key1"?
  </code></pre>