-
I was just trying to teach my Younger Brother (5th Grader) BASIC Programming.
Well it was going on well untill I wrote this to
Explain how we asign values to variables.
Initially
a = 1
b = 2
now if
a = a +b
then a = 3
Now my brother is arguing how
a = a + b can be possible if b is not equal to zero.
I tried to explain to him that it is just a way of writing in Programming languages.
He called me an Ediot (I deserve that :( ).
Is there any way I could explain to him and justify such a syntax ?
-
ha.. thats is a really tough job Active...
-
Tell him that you are assigning the value a + b to a rather than stating a is equal to a + b
-
I can't talk to him about memory...He will simply shout at me.
He agrees that I am assigning the value of a+b to a
But says that I cannot write a = a + b and assume it is
correct.
He says his math teacher will fail him if he wrote like that.
-
If he agrees that you are assigning the value of a + b to a, then why can he not understand that you have to write a = a + b?
-
His confusion stems from the fact that we use a
in both sides of the equal sign.
-
What he actually does in mind is replacing the
characters by their values..
So he thinks like
1 = 1 + 2
-
Tell him to think like this:
Code:
[EMPTY BOX LABELED a] = [VALUE OF a] + [VALUE OF b]
Of course, it isn't really empty...
-
teach him VB, which is easier
-
I will try that....thanks...
-
Sounds like the problem is just notation. You could use a symbol like this <- to explain it, and then just swap it when it comes to running the program. Perhaps you could show him Pascal, that uses := instead of = for assignment. = is for equality in Pascal, as he is thinking of it. BASIC (and VB too) just uses the context to decide which operator it is, assignment or equality.
-
Thanks harry! That should do it.
Now I am using <-- operator for assigning.
I presume he Understood the difference.
-
I think that the easiest (and fairly prowerful) language is VB, because to get the same results in BASIC you need to do a hell of a lot code. because you need to program the mouse.. and draw all the lines and stuff.. but in VB you just click-and-drag, change the properties.. and stuff
I stated VB when I was in 7th grade but i would not have been able to understand it in 5th.
Another good thing in VB is that you can create a program without 1 line of code
-
The = is confusing
just tell him if he still doesnt understand to think of the = as
glass that your putting the stuff on the right into the left.
x = A + B
x is a glass
A + B is the water
this is much more simple to understand it.
-
and if he still doesn't understand it, then tell him to wait a few years untill trying to learn it