# How to initialize variables as a block in the code?

**URL:** <https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948>\
**Category:** Questions about Thunkable X\
**Tags:** variables\
**Created:** [July 7, 2020, 11:14am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948 "2020-07-07T11:14:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rockode/32/75168_2.png) [@rockode](https://community.thunkable.com/u/rockode)\
**Post date:** [July 7, 2020, 11:14am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/1 "2020-07-07T11:14:52Z")

</div>

Like if you look at your code, the initializing block i s always stand-alone. Is there a way to initialize a variable and the block attaches to the other blocks? Please help.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 7, 2020, 11:27am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/2 "2020-07-07T11:27:06Z")

</div>

You can create variables dynamically. To do this, use the setter of the global variable, for which use the second variable instead of the name. By changing the value of the second variable, you can change the name of the global variable.

---

<div class="post-metadata">

**Author:** ![rockode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rockode/32/75168_2.png) [@rockode](https://community.thunkable.com/u/rockode)\
**Post date:** [July 7, 2020, 11:31am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/3 "2020-07-07T11:31:52Z")

</div>

Can you send an example?

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 7, 2020, 1:43pm UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/4 "2020-07-07T13:43:26Z")

</div>

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/39baa000d67d8c0b839239799f18c24113ff4366.png)

---

<div class="post-metadata">

**Author:** ![roumak](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/roumak/32/78203_2.png) [@roumak](https://community.thunkable.com/u/roumak)\
**Post date:** [July 7, 2020, 1:47pm UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/5 "2020-07-07T13:47:06Z")

</div>

Plzz help me also

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 7, 2020, 1:52pm UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/6 "2020-07-07T13:52:28Z")

</div>

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/b/cb3b7ed636718693cffffc10f77dd61140cd8e53.png)

---

<div class="post-metadata">

**Author:** ![rockode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rockode/32/75168_2.png) [@rockode](https://community.thunkable.com/u/rockode)\
**Post date:** [July 8, 2020, 2:55am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/7 "2020-07-08T02:55:45Z")

</div>

I need to INITIALIZE a variable. Not set it to something else…

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:24am UTC](https://community.thunkable.com/t/how-to-initialize-variables-as-a-block-in-the-code/661948/8 "2024-11-08T11:24:58Z")

</div>


