[SOLVED] Configurable name of variable

Hi I’m new in thunkable and not very expert in programming, I’m stuck so I am asking some help.

In this screen I have variable num_map that can have the value of 1 or 2 or 3 or 4 or 5 or 6 , depending on some user decision in previous screens

so I want to get the content of Text_Input5 and save it to a variable named 10 or 20 or 30 etc etc depending on num_map (num_map + zero digit)

In the text block here I am saving it to a variable named ‘10’ but of course this is wrong.
Is it possible to save it into a variable named as the content of ‘curr_var’ ?
Or should I have another approach?

Thanks in advance.


1 Like

Hi @remox,

It’s best to name variables something that describes their contents… not just a single value but a range of values. So instead of “10” you might call it something like “num_map times ten”.

By the way, it’s fine to append (“join”) a 0 to the value of a string (text) but it does convert numbers to text when you do that. If you want to keep the value as a number, you should multiply it by 10 using a math block.

Why are you having the user input a value? It seems like you have three values in play here:

num_map (from a previous screen)
curr_var (num_map*10)
10 (user input)

But you described the issue as wanting to add a zero to the end of num_map, not the end of Text_input5. So I’m a little confused about which variable(s) should have the extra 0.

If you want to save the value of curr_var, just make it a “stored” variable instead of an “app” variable.


@tatiang thanks a lot for the hints and help

I try to be clearer

it’s a quiz with questions
in this screen let’s say we receive from previous screen a num_map = ‘1’
I display question number 10 (that is ‘num_map’ + ‘0’), the user inputs answer in Text_input5 and I want the answer to be stored in a variable named ‘10’

if we we receive from previous screen num_map = ‘2’ I want that the answer to be stored in variable named ‘20’

1 Like

@remox Without getting into should,there are some funny little blocks at the bottom of the variables section which allow you to supply the variable name for app, stored, and cloud variables


Okay, I think I understand better now.

Ideally, you would use a data source (e.g. a spreadsheet) such as a local data source, Airtable, or Google Sheet for something that has many questions like this.

But if you prefer to use individual variables, you can. Yes, you can name a variable “10” although every fiber of my being hopes that you’ll name it “Answer #10” or “Answer to question 10” or something like that… but to each their own!

I would highly recommend that you watch the video I link to here, especially if you are new to programming: My Quiz App jumps from question to question by itself.

Building a quiz app with individual variables is a very tedious way to start out! Because every little change you have to make, you have to then make to all ten “question” variables and then to all ten “answer” variables, etc. etc. If you have ten questions, maybe that’s okay but if you ever want to have 20 or 500, you need to use dynamic programming techniques. It’s possible to make a robust quiz app using a single screen and a few variables and not very many blocks.


@drted THANKS A LOT!
those funny little blocks were exactly what I was looking for… and I couldn’t find by myself

thanks again

thanks @tatiang for your advice and video link, I agree with what you say about the app design. I will finish this small project using variables using the suggestion by @drted (I have only ten questions for each screen now and definitely no plans to add questions) and then I will move to dynamic programming techniques for future ones.