Here is the simple program
The setting for Counter_01 are : counter initial is 0, type is increment, and step size is 1. The program just output the current counter. So I think the output should be like this:
Prompt: counter right now zero
But actually when the program run, the output is:
Prompt: counter right now one
That means on the first time the counter value is initial + 1 (or -1 if it is decrease) ? Not initial value?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The counter initializes AND increments the first time. So it exits with
value 1. From then on, it just increments. If you need it to exit with
value 0, then set its InitialValue to -1.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just read the source code for counter.java, it actually works like there... Thanks for the answer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments
0 comments
Please sign in to leave a comment.