# Nest Function with Update on Stored variable

**URL:** <https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927>\
**Category:** Questions about Thunkable X\
**Tags:** design, bug\
**Created:** [June 12, 2021, 1:46pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927 "2021-06-12T13:46:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![darweeshworkqxl](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@darweeshworkqxl](https://community.thunkable.com/u/darweeshworkqxl)\
**Post date:** [June 12, 2021, 1:46pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927/1 "2021-06-12T13:46:48Z")

</div>

I have tested calling a function inside another function and Updating a stored variable in the nested function but it didn’t work. It only works when the function that is updating is called separately not nested. Here is a screenshot of the Functions Implementations.

When I call SignUp (SignIn doesn’t update the stored variable), however, when I call sign in afterwards it works. I hope this note can help someone, and if it is not a bug and there is a problem with my logic, let me know.

 ![Nested Function Bug](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/8/9826101ea2d883e4b5a3523ae5ab1f9245877a1b.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [June 12, 2021, 1:59pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927/2 "2021-06-12T13:59:34Z")

</div>

The code is missing how you initialize the stored variable and how you check it.

The `Sign In` component only returns `UserId` for verified emails. Your code if not dealing with `IsEmailVerified` and what you think is not being stored is actually an email who just registered and not yet verified.

---

<div class="post-metadata">

**Author:** ![darweeshworkqxl](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@darweeshworkqxl](https://community.thunkable.com/u/darweeshworkqxl)\
**Post date:** [June 13, 2021, 1:05pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927/3 "2021-06-13T13:05:07Z")

</div>

@muneer regarding the initialization it is initialized and values are declared before calling Sign Up function.

Regarding Verified emails, I already allowed registration without verification on Firebase, therefore, I get a userId when I call Sign In.

The issue as mentioned is that calling Sign In inside Sign Up is not Changing the Value in UserData (Property User ID). However, if you call Sign Up separately, then another call to Sign In it works Perfectly.

How did I check it?  
I have tried to call it inside Sign Up and Another Trial with Sign In in a separate function call, then I display the data using a label.

Hope that answered the points you raised!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [June 13, 2021, 1:26pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927/4 "2021-06-13T13:26:26Z")

</div>

> [@darweeshworkqxl](#):
>
> SignIn doesn’t update the stored variable

What exactly you mean by this?  
Does the SignIn function shows a message? Or terminates with return of `false`?

---

<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, 1:20pm UTC](https://community.thunkable.com/t/nest-function-with-update-on-stored-variable/1340927/5 "2024-11-08T13:20:21Z")

</div>


