How to split a text string with \n

So I have this little program:
https://x.thunkable.com/copy/c7c3ff1292aae95ed0bf004c9077893a
This is how the UI looks:

I dont understand how the - " for each Item j in list works". When I type in a bunch of numbers in a rows I want each of the numbers I typed to get initialized to the five variables num1 - num5

thanks

ananda

Sorry, I’m on my phone and can’t look through your blocks but if you’re trying to store user inputs, you would insert each input as the last item in a list variable using this block: Lists - Thunkable Docs

You would only need the “for each item in list” block if you are trying to retrieve the values from that list using a loop.

You would only need the “for each item in list” block if you are trying to retrieve the values from that list using a loop.
Exactly that is what I want to do. What do I put in the the set app variable Num1 etc … that is where I got stuck. Or my usage might be wrong.

The make list from text block will create a string. So app variable InputList is going to be a list of strings. For example, if Input’s Text is “1,2,3,4,5” then app variable InputList would be {“1”,“2”,“3”,“4”,“5”}.

But you’re checking to see if j=1, j=2, j=3, etc. Try instead checking if j=“1”, j=“2”, j=“3”, etc.

Edit: actually, that doesn’t seem to matter. It can match j=1, j=2, j=3, etc. just fine.

Can you explain what you’re trying to do with your for each item loop? What are you wanting to display if j=“1”, etc.? It’s not clear to me what your overall goal is.

1 Like

My bad my bad. Just talking it over with you and reading your comments and questions answered my question. All I wanted to read a text string and get numbers out of it separately. Sorry I should have figured it out myself … too much sleep lost on the product. April 18th is the deadline for Technovation hence the stress :slight_smile: :slight_smile: Thanks again

1 Like

Okay, most likely you just need to do set Output's Text to j within the for each j in list loop, along with a wait block.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.