My code dont work using the block form the list blocks is in the list thing? list

i dont know why dont work i need use the block list thing? list to get if the word is or not in the sentence
there are my blocks and the aia
extract_word.aia (2.2 KB)
blocks(70)

you have forgotten to break the loop after the word has been found
just add a break block
https://ai2.appinventor.mit.edu/reference/blocks/control.html#break

break
When looping using the for range, for each, or while blocks it is sometimes useful to be able to exit the loop early. The break allows you to escape the loop. When executed, this will exit the loop and continue the app with the statements that occur after the loop in the blocks.

Taifun

its ok, the position of my break?

image

No

Taifun

but i make that and its not working correctly

image

image

What about using the “contains text” block?
image
Would be a lot simpler.

1 Like

using the same blocks but replacing the block list thing? list? its correct? or how would be?

I do not have a pc right now to show you, but at the text slot you put textbox2.text and at the piece slot the textbox1 text. If true the text in textbox2 contains the textbox1 text, otherwise it returns false. Check the documentation!

i change using your guide but i get that the word isnt there but the message will be show that the were is there in the sentence what is wrong?

blocks(73)

i make using your guide you can see in my block but its not working correctly because i get in the message that there is not the word in the sentence but the message is wrongm the correct message is that the word is there.
blocks(71)

some help about this?

You did not read what I said. You do not need the list blocks. Only the text block. One simple block instead of everything else.

This is the only code you need:


Delete all other blocks. You do not need button2 either. Try it!

ok thanks

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