Content deleted Content added
No edit summary |
No edit summary |
||
Line 1:
'''Crystal''' is a [[general-purpose programming language|general-purpose]], [[object-oriented programming language|object-oriented]] programming language designed and developed by Ary Borenszweig and Juan Wajnerman. Crystal is developed as open source and its syntax is inspired by [[Ruby (programming language)|Ruby]]. Crystal is statically type-checked but without having to specify the type of variables or method arguments. Its first official release was released in June 2014.<ref>[http://motion-express.com/blog/why-use-crystal-lang Why Crystal programming language?]</ref><ref>[http://crystal-lang.org/2014/06/19/crystal-0.1.0-released.html Crystal 0.1.0 released!]</ref> While the original Crystal compiler was written in Ruby, in 2013 a new compiler written using the Crystal programming language itself was released. <ref>[http://crystal-lang.org/2013/11/14/good-bye-ruby-thursday.html Good-bye Ruby Thursday]</ref>
== Examples ==
=== [[Hello world]] ===
This is the simplest way to write the Hello World program in Crystal:
<syntaxhighlight lang="ruby">
puts "Hello World!"
</syntaxhighlight>
Or using [[object-oriented programming|object-oriented programming]]:
<syntaxhighlight lang="ruby">
class Greeter
def initialize(name)
@name = name.capitalize
end
def salute
puts "Hello #{@name}!"
end
end
g = Greeter.new("world")
g.salute
</syntaxhighlight>
==References==
|