Ruby (programming language)
Ruby is the name of a programming language that was created in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. Like other programming languages, such as Py…
| Paradigm | multi-paradigm: object-oriented, imperative, functional, reflective |
|---|---|
| Designed by | Yukihiro Matsumoto |
| Developer | Yukihiro Matsumoto, et al. |
| First appeared | 1995 |
| Stable release | 4.0.9[1] |
| Typing discipline | duck, dynamic |
| Scope | lexical, sometimes dynamic |
| OS | Cross-platform |
| License | Ruby License or BSD License[2][3] |
| Filename extensions | .rb, .rbw |
| Website | www |
| Major implementations | |
| Ruby MRI, YARV, Rubinius, MagLev, JRuby, MacRuby, RubyMotion, HotRuby, IronRuby, mruby | |
| Influenced by | |
| Ada,[4] C++,[4] CLU,[5] Dylan,[5] Eiffel,[4] Lisp,[5] Perl,[5] Python,[5] Smalltalk[5] | |
| Influenced | |
| D,[6] Elixir, Falcon, Fancy,[7] Groovy, Ioke,[8] Mirah, Nu,[9] Reia, Crystal | |
| |
Ruby is the name of a programming language that was created in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. Like other programming languages, such as Python, its structure (the way it works) is very similar to the English language. It has these qualities:
- Terse. Short, but still easy to understand.
- Dynamic. Easy to change, anytime and anywhere.
- Duck typing. If you think you understand it, you probably understand it.
Many programmers like it because the creator tried to make it easy and nice to use.[10]
Ruby on Rails (RoR) is a web application framework that is implemented using the Ruby language.[11]
Example
An example Hello World program in Ruby:
puts "Hello World!"
An example program in Ruby that asks for your name and then says it:
puts "What's your name?"
name = gets.chomp
puts "Ah hello there, #{name}"
A function in Ruby that joins the 2 strings (or arrays/integers) into one, removes all numbers from it, capitalizes the string and then repeats it 5 times:
def somefunction(arg1, arg2) # creates a function with 2 arguments. the args can be called anything
arg = arg1 + arg2 # this joins them into 1 string
arg = arg.tr("1234567890","") # this replaces all the numbers with a nothing. erases them essentially.
arg = arg.capitalize # read that out loud
5.times do # read that out loud too
puts arg # prints it on a new line
end
end
somefunction("h1e2l6lo7,"," W5o6r8l9d!3") # does the function
Output:
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
References
- ↑ "Ruby 4.0.9 Released". 23 October 2026. Retrieved 26 October 2026.
- ↑ "COPYING in Ruby official source repository". Archived from the original on 2017-03-20. Retrieved 2013-04-22.
- ↑ "BSDL in Ruby official source repository". Archived from the original on 2022-03-21. Retrieved 2013-04-22.
- ↑ 4.0 4.1 4.2 Cooper, Peter (2009). Beginning Ruby: From Novice to Professional. Beginning from Novice to Professional (2nd ed.). Berkeley: Apress. p. 101. ISBN 978-1-4302-2363-4.
To a lesser extent, Python, LISP, Eiffel, Ada, and C++ have also influenced Ruby.
- ↑ 5.0 5.1 5.2 5.3 5.4 5.5 Bini, Ola (2007). Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java. Berkeley: APress. p. 3. ISBN 978-1-59059-881-8.
It draws primarily on features from Perl, Smalltalk, Python, Lisp, Dylan, and CLU.
- ↑ Intro – D Programming Language 1.0 – Digital Mars
- ↑ Bertels, Christopher (23 February 2011). "Introduction to Fancy". Rubinius blog. Engine Yard. Archived from the original on 2018-12-25. Retrieved 2011-07-21.
- ↑ Bini, Ola. "Ioke". Ioke.org. Archived from the original on 2011-07-21. Retrieved 2011-07-21.
inspired by Io, Smalltalk, Lisp and Ruby
- ↑ Burks, Tim. "About Nu™". Programming Nu™. Neon Design Technology, Inc. Archived from the original on 2011-07-24. Retrieved 2011-07-21.
- ↑ "About ruby".
- ↑ "What is the difference between Ruby and Ruby on Rails?".
Other websites
- Official website
- Ruby documentation site
- Ruby Draft Specification- Sep 2010 Archived 2012-03-22 at the Wayback Machine
- Wiki: Ruby language and implementation specification Archived 2013-04-11 at the Wayback Machine
- Ruby at the Open Directory Project
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.