Ruby

From Botdom Wiki

Jump to: navigation, search
Ruby
Ruby
Paradigm Multiple
Appeared in 1995
Designed by Yukihiro Matsumoto
Developer Yukihiro Matsumoto (among others)
Latest release 1.9
Influenced by Smalltalk, Perl, Lisp, Scheme, Python, CLU, Eiffel, Ada, Dylan

Ruby is an interpreted scripting language made for quick and easy object-oriented programming.

Basic Syntax

Local variables in Ruby are not prefixed with any characters. Global variables are prefixed with "$", Instance variables with "@" and Class variables with "@@". Statements must be separated with a line break or a semicolon, but not both.

var = "value" #local
$var = "value" #global
class Test
     @@var = "value" #class
     def initialize
          @var = "value" #object
     end
 
     def test( arg ); arg+1; end
end

You can put strings together (concatenate) using the + operator

var = "string " + "string2"

In Ruby, values are type dependent, the string "1" and the integer 1 are not equal.

if 1 == "1"
     print "Equal"
else
     print "Not Equal"
end #"Not Equal"

Bots Created Using Ruby

The following bots for dAmn were created using Ruby.

Retrieved from "http://botdom.com/wiki/Ruby"
Personal tools