which one cannot be considered as a counter variable?

counter = counter +1
counter = counter -1
counter = counter +3
counter = counter *2

All can be counter variable.

but we were asked to find out the statement which cannot be used as a counter varaible

If pressed, I would say number 4. Counters are incremented by fixed amounts. The increment in number 4 varies depending on the current value of counter. Technically, number 4 could be a counter if (for example) in a loop, the number of things you are counting doubles each time. Then again, you could say number 2 because counters usually count up, however, again, not necessarily true in all cases.

Actually, you were given a pretty dumb question.

>>Actually, you were given a pretty dumb question.
.confusing as well;must say, good teacher.:)

hmm
and even i asked to know the answer..
but the sad thing is that he is also confused and so he thought we(his students) would solve for him..:sad:

See this link.
counter usually used in loop.
For me all those variables can be a counter depend on the case, but if i have to choose one then i would choose the last one.

Edited 4 Years Ago by Jx_Man: n/a

>>which one cannot be considered as a counter variable?
I would say line.4.
.reason: Dim counter As Integer is = to a default.value of 0 and no other line returns a 0 AndAlso counter = 0 *2 will give you the same result as counter = counter *2 .
.p.s.: I don't even know w.t.f a "counter variable" is;though hope this helps.:)

Edited 4 Years Ago by codeorder: n/a

counter usually used in loop

There are many times when this is not the case. For example, a Class variable (which is single instance no matter how many times the class is instantiated) to keep track of how many objects of that class have been created.

Final answer? Number 4.

>>which one cannot be considered as a counter variable?
I would say line.4.
.reason: Dim counter As Integer is = to a default.value of 0 and no other line returns a 0 AndAlso counter = 0 *2 will give you the same result as counter = counter *2 .
.p.s.: I don't even know w.t.f a "counter variable" is;though hope this helps.:)

Yes
i accept this one...
thanks for the explanation...

This question has already been answered. Start a new discussion instead.