Only recently I discovered that the Switch macro is a real jewel, with more features than some high-level languages. Kudos to Greg Falen :t
; Masm32 is enough for this example, but it works with MasmBasic, too
include \masm32\include\masm32rt.inc
; include \masm32\MasmBasic\MasmBasic.inc ;
download.code
start:
; ### Switch with lists and ranges ###
mov eax, 17
; try any combination you like,.. mov edx, 77
mov ecx, 99
mov ebx, 17
Switch eax
Case 1
print "eax is one", 13, 10
Case edx .. ecx
print "eax is between edx and ecx", 13, 10
Case 10 .. 15
print "eax is between 10 and 15", 13, 10
Case ebx
print "eax is the same as ebx", 13, 10
Case 16, 18, 20
print "eax is sixteen or eighteen or twenty", 13, 10
Default
print str$(eax), " is nowhere in the ranges above", 13, 10
Endsw
inkey "OK?"
exitend start