Ruby

Ruby

Installation

Ubuntu
apt install ruby
AlmaLinux
dnf install ruby
Arch Linux
yay -S ruby
Source Code
# Download ruby-{version}.tar.gz from https://ruby-lang.org
./configure [options]... [VAR=VALUE]...
make
make install

Examples

Fibonacci Numbers
# Fibonacci Numbers
def fib(n)
    if (n < 2)
        return n
    else
        return fib(n - 2) + fib(n - 1)
    end
end
puts fib(ARGV[0].to_i)

=begin
example
    ruby fib_rb.rb 39
=end

Crystal

Installation

Binary
# Download crystal-{version}-linux-{arch}.tar.gz
#  from https://crystal-lang.org
tar xzf crystal-{version}-linux-{arch}.tar.gz
mv crystal-{version} /usr/local/
ln -s /usr/local/crystal-{version}/bin/crystal /usr/local/bin/.