"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Joanne
Originally posted by David McCombs:
One key is that e1 and e2 point to the same object.
x=0
e1.count=e2.count = 0 //we will just call e1.count and e2.count, count from here on out
count = count + 1 //(0+1=1)
count = count + count //(1+1=2)
x=1
//end of first loop
count = count + 1//(2+1=3)
count = count + count//(3+3=6)
x=2
//end of second loop
count = count + 1//(6+1=7)
x == 2 so the if block does not execute
x=3
//end of third loop
//while block exits
walking through the code on paper is usually helpful. Adding in print statements to print out the value at certain points is also helpful.
Lys Marie.
The line
Echo e2 = e1;
means that e2 is just another name for e1,
Originally posted by David Vimsekh:
Joanne
I guess if you don't understand about reference variables, this isn't specific enough. I also said that you should replace all "e2" with "e1" after this, since they're equivalent, and you said "that's too confusing". But in fact, that's the central point of this example. Try reading this and this. These two amusing short essays should hopefully clear this all up for you!
You're welcome, and I am sure that applies to everybody. It is good to see we have been sorted things out successfully.Originally posted by David Vimsekh:
Thank You to everyone who helped me . . .
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
|