Functions with dropdown for j i list or variables

Could we get this for variables please?

Where I could create and name a list of functions I have created and call on ‘j function’ for example

I don’t have a github or any of that, not sure how all that works or if this is considered a feature request idk…

Thanks

image

2 Likes

I don’t understand what you are wanting. Are you asking for a loop that runs a function with a variable value that is different each time?

Can you give a concrete example of how this would be used? What is a real life example?

You can submit feature requests here:

1 Like

Hopefully this makes sense, lemme know if you have questions

1 Like

Okay, I understand, sort of. It’s still not a real world example but the screenshot makes sense. You want a function that can be called from a list of functions. I haven’t needed that before but if it’s important to you, submit a feature request and include a link to this topic.

I’d rather have a Case statement block. I can see all sorts of uses for that.

2 Likes

How is a case statement different than

if, else if, else if, else?

This seems less efficient for a situation like mine where I have to create a new else if to my blocks if I add a new function for some reason.

In my example I just create a new function, add it to my list of functions, and then my existing for each item j block will automatically pick it up and do it’s job.

A real world example is I have functions that run depending on a random number.

If RNG returns 1, then run Fx1
If RNG returns 2, then run Fx2

And so on.

I don’t want to build an if block with if, else if1, else if2, else ifₙ, (where ₙ could be 100). Then I have to add the function manually underneath

I’d much rather append a list of functions and list of circumstances and let my for each, or count by i blocks handle it automatically.

Functions have a mutator( blue Gear icon )
If you simply click it a pop up appears and you can add input fields.
Then in the execute function block the input Will appear where you can add your variable “j” block.

See functions docs: https://docs.thunkable.com/functions

-Luke

I may be wrong but I don’t believe that solves the request I’m having.

Are you saying you can make a list of functions you’ve created? And then call on one of them programatically from a for item j, or a count by i block?

Yeah Just Place the function caller inside the loop.

I’m getting this error when I try to add my functions output to a list.
Do you have an example of how to set this up?

Thanks

Why are your functions Orange they are supposed to be purple?

Also you cannot add functions to a list.

If that was What you wanted then I appologize for mis understanding.

Idk, here’s what I have. I was testing some other things and that’s what the red2/green2/blue2 is

I still don’t Get it.

Ok no problem, could you work out how you would go through this process, maybe I’m doing something wrong

1 Like

The only way to do that is with if statements.
Wich if i Read it right this time is not What you want right?

Once again My appologies for mis understanding.

I’m not sure how you’re understanding it, based on my 2nd screenshot can you build what you believe is the solution and post a screenshot?

does this work for you?
https://x.thunkable.com/projectPage/61d1c443ee9607020e0552d7

This seems to be on the right track yes,

What should I add to this last block to cause each Fx to execute depending on which button was pressed?

When there is a well, there is a way

Try this
https://x.thunkable.com/projectPage/61d1e1acff08e90011a5f12e

1 Like

I don’t think I see how this does what I’m wanting.

In my example from my previous screenshot I want the following:

For each item of the red/green/blue buttons, only that specific color Screen Fx should run

If you have the buttons in a row or column then you can check to see if they are #1, #2, or #3 in the list of buttons in that row/column using the “find first occurrence” block.

1 Like