Specific Range testing (problem)

General discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
robert_d1968
Posts: 145
Joined: 14 Nov 2012 00:30
Location: China
Contact:

Specific Range testing (problem)

#1 Post by robert_d1968 » 09 Feb 2017 08:57

Hello everybody,

I'm trying to remake a program I have written With Bascom's compiler to Mikrobasic pro for avr.

In Bascom I did it like this:

Select case (variable name)
case 100 to 500
(do something)

end select

In Mikroe's compiler, it won't work like that. What is a good way to achieve this in Microbasic pro for avr?

Thanks for any help,

Robert

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Specific Range testing (problem)

#2 Post by lana.arsic » 09 Feb 2017 10:42

Hi Robert,

Unfortunately, you cannot use range in Select Case Statement in mikroBasic,
but you can try:

Code: Select all

if ((variable_name >= 100) and (variable_name <= 500)) then
      (do something)
end if
If you need more cases, you can add else if statements.

Best regards,
Lana

Post Reply

Return to “mikroBasic PRO for AVR General”