Twitter Updates

Saturday, 29 November 2008

Ruby Variables

Just brushing up on Ruby from the cartoon fox who loves chunky bacon. Chapter 3 introduces so many types of variables, here is my quick summary of ruby variables.

#Strings
something = "A string"
something2 = 'Another string'

#Integer
somthing3 = 1

#Float
something4 =3.14

#Symbols (light weight strings)
:something5

#Constants (Capitalized)
SOMETHING = "This can never be changed"

#Global Variables (dollar sign)
$somthing100

#Instance Variables
@instanceVar

'Class Variables
@@classVariable

#Calling methods
objectInstance.instanceMethod
objectInstance.add( :red ) , objectInstance.remove( :blue)

Object::classMethods
eg Object::new() , Object::killall

No comments: