Skip to content
Crystal
Specification
Initializing search
GitHub
Home
Specification
Guides
Tutorials
Crystal
GitHub
Home
Home
Getting started
Getting started
An HTTP Server
A Command Line Application
Using the compiler
The shards command
Coding style
Platform Support
Specification
Specification
About this guide
Comments
Documenting code
Literals
Literals
Nil
Bool
Integers
Floats
Char
String
Symbol
Array
Hash
Range
Regex
Tuple
NamedTuple
Proc
Command
Assignment
Local variables
Control expressions
Control expressions
Truthy and falsey values
if
if
As a suffix
As an expression
Ternary if
if var
if var.is_a?(...)
if var.responds_to?(...)
if var.nil?
if !
unless
case
while
while
break
next
until
&&
||
Requiring files
Types and methods
Types and methods
Everything is an object
The Program
Classes and methods
Classes and methods
new, initialize and allocate
Methods and instance variables
Type inference
Union types
Overloading
Default parameter values and named arguments
Splats and tuples
Type restrictions
Return types
Method arguments
Operators
Visibility
Inheritance
Inheritance
Virtual and abstract types
Class methods
Class variables
finalize
Modules
Generics
Structs
Constants
Enums
Blocks and Procs
Blocks and Procs
Capturing blocks
Proc literal
Block forwarding
Closures
alias
Exception handling
Type grammar
Type reflection
Type reflection
is_a?
nil?
responds_to?
as
as?
typeof
Macros
Macros
Macro methods
Hooks
Fresh variables
Annotations
Annotations
Built-in annotations
Low-level primitives
Low-level primitives
pointerof
sizeof
instance_sizeof
offsetof
Uninitialized variable declaration
Compile-time flags
Compile-time flags
Cross-compilation
C bindings
C bindings
lib
fun
fun
out
to_unsafe
struct
union
enum
Variables
Constants
type
alias
Callbacks
Unsafe code
Guides
Guides
Performance
Concurrency
Testing
Writing Shards
Writing Shards
Hosting on GitHub
Hosting on GitLab
Continuous Integration
Continuous Integration
GitHub Actions
Travis CI
CircleCI
Static Linking
Database
Database
Connection
Connection pool
Transactions
Tutorials
Tutorials
Basics
Basics
Hello World
Variables
Math
Strings
Control Flow
Methods
Syntax and Semantics
¶
The program’s source code must be encoded in UTF-8.