Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A quick lesson on: What is IMP?
#4
(05-09-2022, 01:39 AM)PhilOfPerth Wrote: Then I don't get it! If ANY combinations will give 255, what's the point of it, and how could it be used (if I wanted to)? Can you show a (simple) example?

A working demo of IMP, for you:

Code: (Select All)
Dim Man As _Byte, Healthy As _Byte 'our two variables we're going to IMP

Print "Let's determine if you're eligable for a discount for medical insurance."
Print "All women are eligible, as are all healthy men."
Print "Men with pre-existing conditions aren't included in this discount."
Do
    Print
    Print
    Input "Are you a man (Y/N)", Man$
    Input "Are you healthy (Y/N)", Health$
    If InStr(UCase$(Man$), "Y") Then Man = -1 Else Man = 0
    If InStr(UCase$(Health$), "Y") Then Healthy = -1 Else Healthy = 0
    Print Man, Healthy

    Discount = Man Imp Healthy
    If Discount Then Print "You qualify!" Else Print "Unhealthy males don't qualify!"
Loop Until Man$ = ""

Run that a few times and try the various combinations for being a man and being healthy, and remember the rules we set for who qualifies for the insurance discount..

If a man and healthy -- you qualify!
if a man and not healthy -- you don't qualify!
if a woman and healthy -- you qualify!
if a woman and not healthy -- you qualify!

Discount = Man IMP Healthy

As I mentioned in my first post, this is nothing more than a fancy way of writing:  Discount = NOT Man OR Healthy

Swap out that IMP statement for the one above and then run the program again, if you'd like.  Discount = NOT Man OR Healthy runs the exact same as Discount = Man IMP Healthy.
Reply


Messages In This Thread
A quick lesson on: What is IMP? - by SMcNeill - 05-02-2022, 12:35 AM
RE: A quick lesson on: What is IMP? - by SMcNeill - 05-09-2022, 02:54 AM
RE: A quick lesson on: What is IMP? - by Dimster - 07-27-2022, 01:42 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 02:32 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-27-2022, 05:22 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:03 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:27 PM
RE: A quick lesson on: What is IMP? - by Pete - 07-27-2022, 07:37 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:59 PM
RE: A quick lesson on: What is IMP? - by Pete - 07-27-2022, 10:14 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-28-2022, 12:51 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-28-2022, 04:34 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-28-2022, 04:53 PM
RE: A quick lesson on: What is IMP? - by JRace - 07-28-2022, 05:38 PM
RE: A quick lesson on: What is IMP? - by JRace - 11-05-2022, 03:50 AM
RE: A quick lesson on: What is IMP? - by vince - 11-10-2022, 06:56 AM



Users browsing this thread: 6 Guest(s)