Issue with my code

Hi. I've been dealing with an issue with my code for a guess the animal app. But whenever the answer is right it still says false and I've had two people who are pretty good at coding not be able to find out the issue. It would mean a lot if someone could point out what's going on.

Don't use image component.. instead use picture of the component

If animalimage.picture = dog.png

1 Like

Thank you so much that actually worked!

1 Like

I'm having an issue similar to the one I've posted about before and was wondering if theres an issue in my code?

Use the advice you were given before?

i am but it's not working again

can you elaborate? what do you expect the blocks to do and what do you get instead?
Taifun

basically for example if there’s a photo of a rabbit and you type into a text box “Rabbit” it will show text above that photo saying it’s correct and an audio will play. My main issue is it’s not working for any of them. If the answer is correctly written it will still say false in the textbox above.

this is because you are using several if then else statements and each of them will be executed
for example the rabbit...
the first if then else comes to the result it is false
the second if then else comes to the result it is again false
the third if then else comes to the result it is true
the fourth if then else comes to the result it is again false
etc

Taifun

Oh kk. How would I fix this though? Sorry I don’t ever code so this stuff is kinda confusing lol.

you need nested if then else statements

if picture = Rabbit
then if answer = "Rabbit"
     then correct
     else false
else if picture = Dog
then if answer = "Dog"
     then correct
     else false
...

Taifun

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