+ 1

Ruby shorthand

i don’t really get += because a = 1 b = 2 a +=b So in my head it goes 1 = 1+2 I don’t get this. Help

26th Nov 2018, 2:11 PM
Jay
3 odpowiedzi
+ 6
Would be more like a = a+b or you could write it a = 1+2, which now changes the value of a to 3 for any future references until changed again. I hope that helps.
26th Nov 2018, 2:24 PM
Tony
Tony - avatar
+ 6
Cheers m8
26th Nov 2018, 2:32 PM
Tony
Tony - avatar
+ 1
thanks
26th Nov 2018, 2:28 PM
Jay