29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

30<br />

i_111_222 := 1cm ;<br />

i_[111]_[222] := 1cm ;<br />

i_[111][222] := 1cm ;<br />

draw<br />

image (<br />

draw (0cm,i_111_222) ;<br />

draw (1cm,i_[111]_[222]) ;<br />

draw (2cm,i_[111][222]) ;<br />

)<br />

withpen pencircle scaled 5mm<br />

withcolor .625 red ;<br />

Sometimes METAPOST ways are mysterious:<br />

1.7 Conditions<br />

The existence of boolean variables indicates the presence of conditionals. Indeed, the general form<br />

of METAPOST's conditional follows:<br />

if n=10 : draw p ; else : draw q ; fi ;<br />

Watch the colons after the if and else clause. They may not be omitted. The semi--colons on the<br />

other hand, are optional and depend on the context. You may say things like:<br />

draw if n=10 : p ; else : q ; fi ;<br />

Here we can omit a few semi--colons:<br />

draw if n=10 : p else : q fi withcolor red ;<br />

Adding semi--colons after p and q will definitely result in an error message, since the semi--colon<br />

ends the draw operation and withcolor red becomes an isolated piece of nonsense.<br />

There is no case statement available, but for most purposes, the following extension is adequate:<br />

draw p withcolor if n

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!