Re: Condition to logic
Posted by nandona on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Condition-to-logic-tp4034355p4034368.html
Thank you!! I think I figured it out.
This is what I got:
And(a=b, b=sel, out=b1);
Not(in=sel, out=nsel);
And(a=a, b=nsel, out=ar);
Or(a=ar, b=b1, out=out);
so the first one returns b when sel is 1 (not 0)
and the second and return a when sel is 0 (so i does the same thing with the first and but after i changed it to the opposite meaning,1 )
and then the Or statement is to see which one needs to be returned.
if sel was 0
that means that the first and will always return 0 therefore not affecting the last or statement
if sel was 1
then the second and will return 0 therefore not affecting the last or statement
if i got this right, I hope I did