Logic and branching failing

image

In what possible world does this (at event) navigate to “inp time” rather than to “share app”? Clarifying, it’s not going to “share app” and then magically returning (that I’m aware of).

Thx.

@matt_conroy or another staff member can probably answer this best but my understanding of how Thunkable blocks trigger is that the [if] block will trigger and then once those blocks have started their processes, the next block (navigate to inp time) will trigger. And because the navigate to share app block takes a tiny fraction of time to complete, the last block in your screenshot will trigger last and have the effect you described.

I didn’t describe it all that clearly but in summary, that’s not ideal programming. Use an if/else block if you want to have two possible outcomes that navigate to different screens.

I’ve also seen examples of projects where blocks after a navigate block still trigger even though the navigation to a different screen occurs. So a navigate block should really be the last block in any sequence (and ideally, not preceeded by another navigate block).

I deeply appreciate the speed of your response, and detail. Because I was going to smash something. (I may still, but the Ming vase has a reprieve.)

Thanks again for your prompt and helpful help!

Per your suggestion, the enclosed does work as you suggest. But if this is really the correct approach on this platform, as Charton Heston screamed in Planet of the Apes, “It’s a madhouse! A madhouse!”

It would seem to be a very significant point to make to developers that, essentially, within a block, things may appear to happen asynchronously rather than sequentially. I just lost a day of my life trying to figure out why variable values weren’t tracked across screens; didn’t occur to me that they were but that the way logic+branching was processed by Thunkable is…unique.

your blocks run sequentially and any code block began before a screenchange will execute completly even if the screen changes before the blocks run their course. in this case, you first navigate to shareapp, then to inptime. cause thats what your blocks say.

what. you really need is an if/else statement here

The code base for Thunkable is React Native. So it might be useful to read up on how this all works in React Native.

And just a side note that you can resize images you post here. Below the image, when pasting the url or editing the post, you can click the 75% or 50% links. I resized your images for you.

1 Like