Commits

Shlomi Fish committed 8688271

Extract a method.

  • Participants
  • Parent commits 807ef21

Comments (0)

Files changed (1)

File dylan-programs/hello/doors.dylan

 module: doors
 
+define method to_open(x :: <boolean>)
+    if (x) "open" else "closed" end
+end;
+
 define method doors()
   let doors = make(<vector>, fill: #f, size: 100);
   for (x from 0 below 100)
     end
   end;
   for (x from 1 to 100) 
-      format-out("door %d %s\n", x, if (doors[x - 1]) "open" else "closed" end)
+      format-out("door %d %s\n", x, to_open(doors[x - 1]))
   end
 end;