Compiled language with Ruby syntax and type inference.

Crystal is a programming language with the following goals:

  • Have the same syntax as Ruby, or at least as similar as possible.
  • Never have to specify the type of a variable or method argument.
  • Be able to call C code by writing bindings to it in Crystal.
  • Have compile-time evaluation and generation of code, to avoid boilerplate code.
  • Compile to efficient native code.
# Compute prime numbers up to 100 with the Sieve of Eratosthenes
max = 100

sieve =, true)
sieve[0] = false

(2...max).each do |i|
  if sieve[i]
    (2 * i).step(max - 1, i) do |j|
      sieve[j] = false

sieve.each_with_index do |prime, number|
  puts number if prime
Information updated 01/22/14
View Comments