Error G1001 when trying to use 'for' loop and 'do while' loop

Hello,

When I enter even a basic code for  a 'for' or 'do while' loop it does not work.  I get a G1001 error.  What am I doing wrong?

Thanks.

1 Answer



0



A basic for loop might look like this:

for i(1, 4, 1);
   print i;
endfor;

This code will return:

1.00
2.00
3.00
4.00

If you leave out the endfor statment, you should get the error:

G1001 : found 'End of File' : Expected keyword 'ENDFOR' 

A basic do while loop might look like this:

i = 10;
do while (i > 0.5);
   print i;
   i = i./2;
endo;

This code will return:

10.000
 5.000
 2.500
 1.250
 0.625

If you leave out the endo at the end, you would get the error:

G1001 : found 'End of File' : Expected keyword 'ENDO' 

aptech

1,773

Your Answer

1 Answer

0

A basic for loop might look like this:

for i(1, 4, 1);
   print i;
endfor;

This code will return:

1.00
2.00
3.00
4.00

If you leave out the endfor statment, you should get the error:

G1001 : found 'End of File' : Expected keyword 'ENDFOR' 

A basic do while loop might look like this:

i = 10;
do while (i > 0.5);
   print i;
   i = i./2;
endo;

This code will return:

10.000
 5.000
 2.500
 1.250
 0.625

If you leave out the endo at the end, you would get the error:

G1001 : found 'End of File' : Expected keyword 'ENDO' 

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.