[metapost] Unable to figure out "if"

Shriramana Sharma samjnaa at gmail.com
Wed Aug 8 08:44:45 CEST 2012


Hello -- consider the following fragment:

beginfig ( 1 ) ;
for i = -60 step 10 until 61 :
	if i > -31 and i < 31 :
		anta = 70 ;
	else :
		anta = 60 ;
	fi ;
	draw ( -anta, i ) -- ( anta, i ) ;
	draw ( i, -anta ) -- ( i, anta ) ;
endfor ;
endfig ;
end ;

But I am getting the error:

>> -31
>> -60
! Not implemented: (known numeric)and(known numeric).
<to be read again>
                   <
<for(-60)> if(EXPR0)>-31and(EXPR0)<
                                   31:anta=70;else:anta=60;fi;draw(-anta,(EX...
l.10 endfor
            ;
? ^C

Please tell me what I am doing wrong? (Really -- these differences in
the syntax of the if/for etc from common programming practices really
is a stumbling block in MP syntax... I suppose it has something to do
with them all being implemented as macros and not language constructs
or something?)

-- 
Shriramana Sharma


More information about the metapost mailing list