Having seen that link entries can be updated you may now be wondering if data entries can as well. The answer is that they can using the COPY DQF. The DQF is used as follows:-
' _ copy _my_data, ' ' source, ' ' num_words; 'where:-
' _ copy _my_data, 1; 'will store 1.0 in _my_data. As all DQF's have to return values, COPY dutifully returns 1.0, which you unlikely to want; its the side effect of updating its first parameter that is of interest. Note the COPY won't operate if any of its parameters are undefined, and this includes its first parameter.
One use of COPY is as a way of storing alternative results in an entry depending on the result of some test. Suppose two entries _my_data_1 and _my_data_2 hold alternative results and _my_test is used to decide which is to be store in result. This can be done as follows:-
' result equals _my_data_1; ' ' _ jump_true +2., _my_test; ' ' _ copy result, _my_data2; '
It can also be used to form simple counters, exploiting the fact that the EQUALS DQF sums its parameters if more than one:-
' counter equals 0. ' #. #. #. ' _ equals counter, 1.; ' ' _ copy counter; 'The first line clears the counter to zero. Later, counter plus 1. are summed and stored in an unnamed entry. The following COPY has only a single parameter so takes as its source the previous word and copies it into counter.