How do i fix these problems?

Hello, i'm creating a BMI calculator for a school project. It was only necessary a working app, but i got curious and started to improving it. Then, i found some problens i wanted to fix, but i don't really know much about programming in any kind of platform. I want the calculator to not try calculating "0", negative numbers, or hollow spaces; because all of them create errors and can close the app (also, i want to limit the height and wheight you can place in the boxes). I made it so notifications appear if you do any of the above, but the calculator still try to calculate them. Can someone help me? Thanks.

If it's necessary to me send more pictures, please say it (half of the blocks in this picture). Also, i am using the height in meters and the weight in kilos.

In your Calculate Button Click event, you have an if/then/elseif ladder block for all the possible errors.

It is missing an else socket at the bottom to hold the code to run if all the errors were avoided.

Use the blue button in the if/then block to add the else socket at the end.
controls_if

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

1 Like

Thank you very much, i can't believe something this simple could be the resolution. Well, i guess thats how programming is. :smile:

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