💎 Diamonds are forever 💎

Crystal is a programming language inspired by [Ruby]. While Ruby is interpreted and dynamically typed, Crystal is compiled and statically typed.

Crystal and Ruby both have this quirk, which is important to know for developers who know {JavaScript}. In JavaScript, backticks around a string indicates a format string. BUT in Crystal/Ruby, strings with backticks denote a command to be literally run in the shell. So, that's very dangerous, given JS developers may think they can insert user generated content into this.

Hello World in Crystal

puts "Hello World"

Recursive factorial in Crystal

def factorial(n)
    # Lines at the end of a function are returned
    n == 1 ? 1 : n * factorial(n - 1)
end

# Crystal does have format strings, they look like this!
puts "The factorial of 5 is #{factorial(5)}"

incoming(1) | software