# Access variable via String

**URL:** <https://forum.kirupa.com/t/access-variable-via-string/283866>\
**Category:** Uncategorized\
**Created:** [March 11, 2009, 11:12pm UTC](https://forum.kirupa.com/t/access-variable-via-string/283866 "2009-03-11T23:12:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pardoner](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@pardoner](https://forum.kirupa.com/u/pardoner)\
**Post date:** [March 11, 2009, 11:12pm UTC](https://forum.kirupa.com/t/access-variable-via-string/283866/1 "2009-03-11T23:12:38Z")

</div>

Is there a way to access a variable via a String? Something like this:

```auto

var myVar1:Int = 1
var myVar2:Int = "myVar1" as variable name

```

This is obviously doesn’t work (and in this case pointless), but is there a way to do this?
