The loop command starts the loop and is followed by the number of repetitions. This is the only argument. Similarly, to JavaScript the line has to be terminated with a semi colon (;).
Example 1;
loop 20;
      hexagon 30;
      move 0,0;
      star 10;
next;
Example 2;
loop 10;
      #fill_r=rand(10);
      loop 10;
            C_ARRAY.CREATE 1000,ca2,200,200+#rep_count[1]*100,30+#rep_count[2]*60,30,50;
      next;
next;
The if statement is used in patricjs for selection. The statement is in the format if condition then it will do the following lines until an end if command line is encountered. Each of these lines has to be terminated by a semi colon (;).
Example;
loop 50;
     if multiple 2;
          fill_colour teal;
     else;
     fill_colour orange;
   end if;
     dodecagon 50;
     move 0,0;
     fill_colour random;
     hexagon 30;
     move 0,0;
     fill_colour yellow;
     star 15;
next;