int a = 5; // a is displayed as an integer that equals 5.
int b = 2; // b is displayed as an integer that equals 2.
b = a; // b now equals a which means b is 5.
a = -3; // a is now equal to -3 which means a is -3 instead of 5.
a = -5;
a = -7;
Console.WriteLine(a); // will write the line a.
Console.WriteLine(b); // will write the line b.
Console.ReadKey(); //Waits till you click any key to close the console.
a = 5; <—- this is a variable
This is me declaring the variable more then once. ( the end result a equals -7 on console.
a = -3;
a = -5;
a = -7;
in question 3 on the first quiz it says
"How many times must a variable be declared?"
I wrote: "Variables must be declared at least once to use it."
but your wrote "miltiple declarations will prevent the code from compiling."
i just declared it 3 times and it compiled O.o…
so im confused there.
Out of the following which are legal variable names? answer, 1stValue, value1, $message, delete-me, delete_me, PI.
I said "answer, delete_me"
you said "answer, value1, delete_me, PI.
And in rule #5 you clearly said: "if your variables end with a number , you probabaly need a better name: count1"
count1 is the same as value1.
so im not sure why value1 is an answer?
and also why is PI an answer O.o….
cause rule #3 says dont abbreviate or remove letters. PI has nothing to do with value1,answer O.o.. ( or for PI, your just implying that you can use short forms and dont remove letters?)