and duck typing Everything is an expression (even statements) and everything is executed imperatively (even declarations) Succinct and flexible syntax that minimizes syntactic noise and serves as a foundation for domain-specific languages Dynamic reflection and alteration of objects to facilitate metaprogramming Lexical closures, iterators and generators, with a block syntax Literal notation for arrays, hashes, regular expressions and symbols Embedding code in strings (interpolation) Default arguments Four levels of variable scope (global, class, instance, and local) denoted by sigils or the lack thereof Garbage collection First-class continuations Strict boolean coercion rules (everything is true except false and nil) Exception handling Operator overloading Built-in support for rational numbers, complex numbers and arbitrary-precision arithmetic Custom dispatch behavior (through method_missing and const_missing) Native threads and cooperative fibers (fibers are a 1.9/YARV feature) Support for Unicode and multiple character encodings. Native plug-in API in C Interactive Ruby Shell, an interactive command-line interpreter that can be used to test code quickly (REPL) Centralized package management through RubyGems Implemented on all major platforms Large standard library, including modules for YAML, JSON, XML, CGI, OpenSSL, HTTP, FTP, RSS, curses, zlib and Tk Just-in-time compilation Syntax The syntax of Ruby is broadly similar to that of Perl and Python. Class and method definitions are signaled by keywords, whereas code blocks can be defined by either keywords or braces. In contrast to Perl, variables are not obligatorily prefixed with a sigil. When used, the sigil changes the semantics of scope of the variable. For practical purposes there is no distinction between expressions and statements. Line breaks are significant and taken as the end of a statement; a semicolon may be equivalently used. Unlike Python, indentation is not significant. One of the differences from Python and Perl is that Ruby keeps all of its instance variables completely private to the class and only exposes them through accessor methods (attr_writer, attr_reader, etc.). Unlike the "getter" and "setter" methods of other languages like C++ or Java, accessor methods in Ruby can be created with a single line of code via metaprogramming; however, accessor methods can also be created in the traditional fashion of C++ and Java. As invocation of these methods does not require the use of parentheses, it is trivial to change an instance variable into a full function, without modifying a single line of calling code or having to do any refactoring achieving similar functionality to C# and VB.NET property