I am working on a calculator app. Getting the decimal point to appear once within an input is proving difficult. Also, I enabled the NumberOnly property in the textBox component. Here are the necessary blocks.
The variables are firstNumber, operator, secondNumber
Assume a number is clicked "5", it will be saved as a firstNumber. But if decimal point is clicked immediately, then it will be "5." any number that come next say "4".
So, firstNumber will be updated to 5.4
Then an operator is clicked, say + for addition, automatically, the next number after operator will always be the secondNumber.
The secondNumber can be a whole number or number with decimal say. So if 4 is pressed, then follow it with decimal point with another number say "7", secondNumber will be updated to 4.7.
The textBox is only displaying the figure. Even I initially make used of label but when decimal point issue arises, I changed it to textBox with the hope of making the numberOnly property true to solve the issue.
On List:
I am using the app to teach kid about how to use app inventor so we aren't yet treating list.
Your original code was very close.
(edit - no, the elseif is in the wrong place. It should be on the outer if. - ABG)
That blank text box may or may not have a blank in it. It's impossible to tell without trying to type in it. AI2 trims blanks, so it might be a zero length text, or a single blank.
An is empty test would be safer, hopefully covering both cases.