# About error G0156 : Illegal redefinition of procedure 'idx' [example1.prg.gss, line 12]

The GAUSS code below is giving me the error `G0156: Illegal redefinition of procedure 'idx'`.

How can I fix it?

``````new;

// law of large numbers
nnn = 10;
xxx = rndn(nnn,1);
mmm = zeros(nnn,1)
idx = zeros(nnn,1);

iii = 1;
do until iii > nnn;
idx[iii,1] = iii;
mmm[iii,1] = meanc(xxx[1:iii,1]);
iii = iii + 1;
endo;

print idx~mmm;``````

0

Short answer: the line assigning to `mmm` is missing the semi-colon at the end.

Explanation
The problem is that the line:

``mmm = zeros(nnn,1)``

does not end with a semi-colon. Since GAUSS statements do not end until there is a semi-colon, the statement that was sent to GAUSS was:

``mmm = zeros(nnn,1) idx = zeros(nnn,1);``

That is not a legal GAUSS statement.

If you look at this code in the GAUSS editor, you see that it puts an error marker to the left of both lines which gives you a clue to look at the line that assigns to `mmm` as well.

aptech

1,773

0

Short answer: the line assigning to `mmm` is missing the semi-colon at the end.

Explanation The problem is that the line:

``mmm = zeros(nnn,1)``

does not end with a semi-colon. Since GAUSS statements do not end until there is a semi-colon, the statement that was sent to GAUSS was:

``mmm = zeros(nnn,1) idx = zeros(nnn,1);``

That is not a legal GAUSS statement.

If you look at this code in the GAUSS editor, you see that it puts an error marker to the left of both lines which gives you a clue to look at the line that assigns to `mmm` as well.

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.