an exercise to make me realise the difference between a primitve and a reference type. Because a var that is assigned a primitive type merely copies the contents of the memory location you can't change it with this code. Because val2 is a reference type, which copies the handle to and not the value in, the memory I am able to edit the value and update it to the new value.
bravetea / module2_exercise_wholenum Goto Github PK
View Code? Open in Web Editor NEWan exercise to make me realise the difference between a primitve and a reference type. Because a var that is assigned a primitive type merely copies the contents of the memory location you can't change it with this code. Because val2 is a reference type, which copies the handle to and not the value in, the memory I am able to edit the value and update it to the new value