Skip to content

10. X Marks the Spot

In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.


Using everything that you’ve learnt so far, write a function that takes a size as right argument and draws a large X of that size. Use backslash symbols (\) and slash symbols (/) for the diagonals:

      {answer} 4
\  /
 \/ 
 /\ 
/  \

When your function is given an odd number as argument, then the diagonals meet in a single letter. Put an X there:

      {answer} 5
\   /
 \ / 
  X  
 / \ 
/   \