Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Program name

  • PROGRAM_NAME
puts PROGRAM_NAME
  • When running with crystal examples/intro/program_name.cr:
/root/.cache/crystal/crystal-run-program_name.tmp

We can also compile it

crystal build examples/intro/program_name.cr
  • This will generate program_name (as that was the name of our source file)

  • We can rename it: mv program_name other

  • We can run it ./other and it will print the name of the executable file other.

  • See other top-level variables