Ask Question

How is a most recent variable different from a fixed variable

+3
Answers (1)
  1. 5 September, 09:19
    0
    In this program, there are three variables: data, count, and value. In the first loop, a user is requested to enter the number of values to be later processed in the second loop. This number is requested repeatedly until the user gives a positive value. The variable data is used to store the latest input read, and there is no possibility for the program to guess what values the user will enter.

    The variable value is used similarly in the second loop: it stores the latest input, and there is no known relation between its successive values.

    The variable count, however, behaves very differently. Once it has been initialized its future values will be known exactly: it will step downwards one by one until it reaches its limiting value, i. e. zero.

    In the following the variables data and value are said to have the role most-recent holder (as they store the latest value in some value succession - user input in this case), and the variable count is said to be a stepper. These roles occur in programs again and again. In fact, only ten roles are needed to cover 99 % of all variables in novice-level programs.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “How is a most recent variable different from a fixed variable ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers