And/Or in selective structure

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

And/Or in selective structure

lllllllalalala
Hi,
    I would like to know if I want to write something like if(a>0 && b>0) then do ...... in CPU Emulator, what I can do to present && (which is used in high-level language) here?
Reply | Threaded
Open this post in threaded view
|

Re: And/Or in selective structure

WBahn
Administrator
You need a sequence of assembly language instructions that will evaluate that expression and then execute a block of code if the result is True and skip that block of code if it is not.

So right away you can see that this breaks down into two pieces.

Step 1: Evaluate the expression and place the value somewhere.

Step 2: Skip past a block of code if the value stored somewhere is not True.

You can then break Step 1 down further in terms of the individual operators involved.