https://crystal-lang.org is just like Ruby, but it compiles and has threads.
Download the .tar.gz from https://github.com/crystal-lang/crystal/releases/
Extract and add bin/
to PATH
.
Adds crystal
and shards
to PATH.
crystal play
crystal build hello.cr
crystal build hello.cr --static
crystal run hello.cr
crstyal init lib mylib
crystal init app myproject
To package and share a module, push to github with the shard.yml
file.
To add a package as a dependency in your projects shard.yml
:
dependencies:
myproject:
github: your-github-user/myproject
Run shards install
To require a dependency in the code:
require "myproject"
Write docstrings with Markdown formatting to generate docs using:
crystal docs
Example hello.cr
file:
# hello.cr
puts "Hello!"