# Do these 2 codes do same thing?

7 messages
Open this post in threaded view
|

## Do these 2 codes do same thing?

 //RAM[17] = 10 @17 M = 10 or //RAM[17] = 10 @10 D=A @17 M=D Thanks!
Open this post in threaded view
|

## Re: Do these 2 codes do same thing?

 This post was updated on . Conceptually, yes, they have the same end result. (Note that you cannot use a constant in the command M = 10.) Edit: correction below...
Open this post in threaded view
|

## Re: Do these 2 codes do same thing?

 But I see in Branching lecture, I see that @R1 M=0 or @R1 M=1 I'm a little confused about when I can use direct assignment vs indirect using "D".
Open this post in threaded view
|

## Re: Do these 2 codes do same thing?

 You are correct, and my original response is not accurate. I should have said "We can only use the literal constants 0 and 1." For all other constants, we must use an A instruction. Thank you for pointing out my error!
Open this post in threaded view
|

## Re: Do these 2 codes do same thing?

 Ah.. Thanks! I much appreciate it. :)