Syntax problem

x=rndu(100,1);
meanx=meanc(x);
if meanx<0.33;
print "Unusually low"
elseif 0<meanx and meanx<0.66;
print "Just right"
else;
print "Unusually high";

endif

Syntax error "elseif"

why?

2 Answers



0



In GAUSS every statement needs to end with a semi-colon. You are missing the semi-colon after print "Unusually low". Since there is no semi-colon to end this statement, the statement continues with the next line and you end up with one statement like this:

print "Unusually low" elseif 0 < meanx and meanx < 0.66;

That is not a legal statement in GAUSS. Here is the corrected version with 3 missing semi-colons added:

x=rndu(100,1);
meanx=meanc(x);
if meanx<0.33;
   print "Unusually low";
elseif 0 < meanx and meanx < 0.66;
   print "Just right";
else;
   print "Unusually high";
endif;

aptech

1,393


0



thanks a lot

Your Answer


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.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy