# How to nest gets from Local Storage?

**URL:** <https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052>\
**Category:** Questions about Thunkable X\
**Created:** [September 5, 2018, 2:13am UTC](https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052 "2018-09-05T02:13:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shriram](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@shriram](https://community.thunkable.com/u/shriram)\
**Post date:** [September 5, 2018, 2:13am UTC](https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052/1 "2018-09-05T02:13:02Z")

</div>

Sample app: two TextInput fields, both of whose contents are written to Local Storage (call them “first input” and “second input”). Now you want to pull out the two values and add them together.

The code that we wrote is as follows. I don’t have the ability to paste an image here for complicated reasons, so I’ll write in a textual equivalent:

```
when Button3 Click do:
  in Local_Storage1 call Get:
    key "first input"
    with output <green value>
    then do:
      in Local_Storage1 call Get:
        key "second input"
        with output <green value>
        then do:
          from TextInput4 set Text to:
            <green value> + <green value>

```

where is the green block named `value` that is supplied by default by LocalStorage.

Note that it seems confusing that both `value`s are the same color. That’ll be an issue soon!

Nevertheless, we very carefully dragged the _first_ green `value` to the left of `+` and the _second_ green `value` to the right of `+`.

Despite this, the output is always twice the second input. That is, the second green `value` masks the first green `value`.

In other words, the two `value`s don’t have individual identities. Rather, they have only their name, and the second name masks the scope of the first one. Really, each `value` ought to be distinct, and its distinctiveness would ideally be represented by a difference in color or shade (so you’d know which `value` you dragged where).

I tried right-clicking on the `value` block to see whether it offered a way to alpha-rename, but it does not appear to (unless I missed something?).

So I’m not entirely sure how to suggest my daughter rewrite the above program.

Thanks for any help!

Broader Notes:

- If the getter would just return a value, then there would be no need for any of this: the two arguments to `+` would be the two calls to the getter.

- If the getter would take a variable as the place to deliver its output, we could create two variables, but it doesn’t. We created a variable and tried to drag it in place of `value`. It appear to slot in and displace `value`, but there was some weirdness on screen. The weirdness grew much greater once we dragged the outer block: the variable’s block left shadow trails all across the screen. It was a psychedelic sight to behold!

- This extreme-sequential programming interface for Local Storage is really ugly. It’s like the worst case of continuation-passing style: all the clunky sequentiality _without_ even the benefit of fresh names!

- If the interface hangs around, `value` ought to be treated hygienically (in the Scheme macro sense).

Having getters return values would completely clean up the above code, of course, and avoid the last three items above. However, the lack of hygiene may affect other components that must follow this extreme-imperativity pattern, so this probably needs a broader look.

---

<div class="post-metadata">

**Author:** ![Rob\_Schoemaker](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rob_schoemaker/32/21023_2.png) [@Rob\_Schoemaker](https://community.thunkable.com/u/Rob_Schoemaker)\
**Post date:** [September 9, 2018, 2:37pm UTC](https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052/2 "2018-09-09T14:37:21Z")

</div>

You could just create variables and assign value to the variable before the second call. Something like:

![28](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/e/fea1b1c4dca11a556933533e483af46d194730b5.png)

Regards Rob

---

<div class="post-metadata">

**Author:** ![shriram](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@shriram](https://community.thunkable.com/u/shriram)\
**Post date:** [September 9, 2018, 6:15pm UTC](https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052/3 "2018-09-09T18:15:00Z")

</div>

Thanks for the helpful response.

I was not quite clear enough in my question: I could indeed, but my issue is at least partly pedagogic. I don’t think there’s any way to have expected my kid to have thought of that, or even to necessarily understand why that’s the right thing to do. Given that the documentation is silent on this, I’m wondering how others who use Thunkable deal with this very natural situation, which surely shows up a lot.

---

<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:59am UTC](https://community.thunkable.com/t/how-to-nest-gets-from-local-storage/45052/4 "2024-11-08T11:59:45Z")

</div>


