Is there a switch case extension instead of numerous if/then/else?

I tried, but could not find one. No relevant topic here either.

1 Like

How many if/then/else variants?

If there are so many, maybe what you needed was a table or dictionary lookup.

See the question/answer/score table in How do I program multiple choice questions that include different text for each wrong answer.
Because the score per answer is part of the table, there is no need for an if/then test to decide to add to a score or not, since the score increment is built into the table structure.

This is called table oriented programming.

1 Like

You could use the webviewer and run some javascript against your data...

returning the result with the webviewstring

1 Like

is that for AI2?

An opportunity for extension developers. In many programming languages it is called a Case statement. App Inventor would certainly benefit from a Case statement. I am not aware of any current extension that can do this with App Inventor.

For all the extension developers, here is some java code https://www.geeksforgeeks.org/switch-statement-in-java/ that shows how to write a Case statement that might help making an extension.

3 Likes

that will be awesome, btw, can anyone make list component more powerful such as sublist

A post was split to a new topic: Switch Case Extension

I moved the new Switch Case extension by @marco_tanzi into its own thread, so later we will be able to find it again...

Taifun

1 Like