Google
 

Wednesday, December 27, 2006

overview of Ruby Part 1

First of all Ruby is an interesting language basically its coding is composed of simple english sentences which can be understood by both computers and people. The thing to remember the syntax relies on using puncuation marks at the proper point. THIS IS IMPORTANT. On to the basics of ruby

Variable- in ruby any plain or lower caseword is a variable, it may consist of letter, digits or underscore.
eg rouge, 1242 or attack_foils
these are used to refer to things within your coding

Numbers- there are 2 types of number

        • Integers - for basic digits
            • in these you cannot use commas between digits
eg: 12 or 1000_000_000
        • Floats - this what decimal numbers are called in ruby any number with scientific annotaion can also be called a floa
eg 3.14, -808.08
String - Strings are any sought off collectin of characters whicj are surrounded by quotes
both double and sigke quotes are used to denote strings
eg : "I am the Darth Mara" & ' I wish '

Symbols - These are words thta look like varibles but start with a colon (:)
eg- :Anderson , :X1
They can be considered as lightweight strings which wont be written to the screen

Constants-
Any Capitalized word is a constant in Ruby. They are used to insert unchanging information in coding
eg: Time , Array

Methods - Methods are usually attached to the end of a variable by a dot
eg : attack_foils.lock
if variables were the nouns of ruby then methods would be the verbs of it . so basically methods are action that can be omplemented on the variable.



To be continued

No comments: