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 = Array.new(max, true) sieve = false (2...max).each do |i| if sieve[i] (2 * i).step(max - 1, i) do |j| sieve[j] = false end end end sieve.each_with_index do |prime, number| puts number if prime end
Information updated 01/22/14