Greater than or equal to ...AND...less than or equal to

Hi!

I wanted to know what´s the best way to do a range of numbers with a LOGIC block. I want to test with an IF...Else, when the answer is the range of numbers from 11 to 20...but i dont want to do an IF block for every number in that range.

Would apprecciate some light into how this works, thanks!

1 Like

Yes, this is the way to do it...
Does it not work for you?
Taifun

it´s not working....I´ll check my global answer...Thanks

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I once programmed a tax table in a payroll program using a table based approach.

Load a CSV table from your Media folder (//) with 2 columns

  • base (minimum value) of range
  • applicable lookup result, like your text values

The table has to be in ascending order by column 1 (the range base).

To do the lookup, start at the end of the table (length of list) and descend (for each index from length of list(lookup_table) to 1 by -1) until K15SYS_100 >= (select item 2 from row number index of lookup table)
and break when your value exceeds the base of that row of the lookup table.

I am assuming your first row will be less than or equal to the lowest possible value of H15SYS_100.

Here is a sample table lookup by range, for single US Federal tax payers, loading the table from the Media folder ...
tax_table_lookup.aia (5.9 KB)
Tax table CSV:
Single.txt (116 Bytes)

Choosing which tax table (I only coded one)


I kept getting a short row at the end of my table, so I added a procedure to trim short rows:


The removal has to work its way down from the end, because the indices collapse after each removal.

I used lots of well named global variables for visibility, sanity checking, and traceability.

Be sure to try the About button, because today is US Federal Tax day traditionally April 15th.

I regret I have no screen shots, because my MemuPlay emulator has been clogged lately.

Is you are getting any error? If yes, send that error or send your full block