Cool (程式語言)

Cool係1996年由亞歷山大亞堅例子 
class Main : IO is
  Main() begin
    out_string("Enter an integer greater-than or equal-to 0: ");

let input: Integer := in_int(); in
      if input < 0 then
        out_string("ERROR: Number must be greater-than or equal-to 0\n")
      else
        out_string("The factorial of ").out_int(input);
        out_string(" is ").out_int(factorial(input))
      fi
    end
  end;

factorial(num: Integer): Integer := if num = 0 then 1 else num + factorial(num - 1) fi;
end;
</ul></ul></ul></ul></ul></ul>

參考 
 Cool: A Portable Project for Teaching Compiler Construction
 CoolAid: The Cool 2008 Reference Manual
 (Un)CoolAid: The UnCool Reference Manual

Cool: The Classroom Object-Oriented Language project main page
程式語言