Can someone help? I'm not an experienced coder but we use this app to learn and code (in a way), and I'm doing this bmi calculator for a project.... I need to fix this very soon


Can someone help? I'm not an experienced coder but we use this app to learn and code (in a way), and I'm doing this bmi calculator for a project.... I need to fix this very soon


you are using the divide block and the first element is an empty string

here are you using the divide block

one solution is to set height_input to 0 in the Designer
or do some data validation before doing any calculation, i.e. check if height_input is not empty
Taifun
Im sorry im stupid, but i dont think I understand what you mean. How do I check if my height_input is empty, because I can remember when the app still worked even if the: height_input.Text/100; was still there. Now it doesn't. Im sorry I just need clarification since i am new to this app but I am very much willing to learn.
If is empty height_input Text
Then "please enter a height"
Else do the calculation
You can find the is empty block in the text drawer
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .
Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by
Taifun.
Turns out that there seems to be no problem with my blocks. It's either my phone or device because when I tested the app on another phone, it did in fact- work without problems. The error that occurred didn't even appear. But it could also be a bug of the app inventor itself. (Your comment helped me either way, thank you so much!)
We might respectfully disagree with your assumption.
Have you set the height_input textbox to 0 in the designer? You should do this for all your textboxes used for calculations, so that they are not "empty" on initialisation.
Nope I did not set height_input textbox to 0 in the designer, yet it worked flawlessly. I'll take note to do that though, so that next time I encounter something like this (that doesn't go away even with different devices) then I'd know what to do.
Thanks much.
Yes, if you enter a value in that textbox, then the calculation worlks without any additional checks
Only if you do not enter anything and the textbox stays empty, then you get that error
Taifun