Monthly Archives: July 2015

Tips&Tricks – If-Then-Else condition Part II

In my blog post HERE, I showed how you can use data structures along with App Inventor procedure to loop through a set of conditions to check if a user entered value falls within a data-range. The approaches that were discussed will drastically reduce the number if if-then-else statements and will also make maintenance much simpler.

Part II will show you how to check for single values rather than a range of values.

For example, consider the situation where you need to bring-up different web-pages based on user response. For this, the simple approach, as shown below, would be to include a set of if-then-else blocks:


Above approach would require additional “else-if” blocks for adding in more criteria. An alternative to above, would be to use LIST along with PROCEDURE block as shown-below:


Now consider situation where you have to add in more criteria; e.g. provider4, provider5, and so on. Using above approach, you’ll only have to update comparisonCriteria block and there will be no change in any other blocks.

Other approaches includes using two synchronized lists, reading data from file using File component, downloading initial set of data from cloud and so on.


Leave a comment

Posted by on July 24, 2015 in Uncategorized

%d bloggers like this: