+ 3

Why we can't write x=z it give error when we write x=z but when we write z=x its gives no error

https://code.sololearn.com/WDVYPHd6okI9/?ref=app

15th Oct 2017, 6:56 AM
Arpan Kanwer
2 ответов
+ 3
If you wrote x = z, you would assign to the variable 'x' the value of 'z', but in your program there was no variable 'z' declared, thus it is unknown to the compiler. The other way round you declare a variable 'z' and assign it the value of 'x' (here: 2), which was declared before and therefore known by the compiler. In short: You cant work with variables you havent declared before.
15th Oct 2017, 7:03 AM
Shadow
Shadow - avatar
+ 2
thx bro
15th Oct 2017, 7:26 AM
Arpan Kanwer