2012年12月22日 星期六

Ruby on Rails Guide - part 1

This is RoR Guide - part 1 written by me.

Agenda:

1. installation

2. write the first application


2012年11月18日 星期日

Learn To Program - Part1

[Slide]


Ruby introduction part1 from Brady Cheng


[Quick Review]

Numbers
Integer, a series of digits which can start  with a plus or minus sign.
1 ,  23 , and  -10000  are examples
population = 12_000_000_000 is also an example.

Float, consists of numbers with a decimal place or scientific notation.
3.14 ,  -808.08  and  12.043e-04  are examples

Strings
Any sort of characters (letters, digits, punctuation) surrounded by quotes. Both single and double quotes are used to create strings.
"sealab" ,  '2021' , or  "These cartoons are hilarious!" are examples.

Symbols
Like variables. contain letters, digits, or underscores. But start with a colon. Symbols are lightweight strings. Usually, symbols are used in situations where you need a string but you won’t be printing it to the screen.
:a ,  :b , or  :ponce_de_leon  are examples.

Constants
Constants are words like variables, but constants are capitalized.
Time ,  Array  or  Bunny_Lake_is_Missing  are examples.


Variables
Any plain, lowercase word is a variable. Variables may consist of letters, digits and underscores.
x ,  y ,  banana2  or  phone_a_quail  are examples.

Global variables
Variables which begin with a dollar sign are global.
$x ,  $1 ,  $chunky  and  $CHunKY_bACOn  are examples.


Instance variables
Variables which begin with an at symbol are instance variables. Instance variables are used to define characteristics of a single object. Think of the at symbol as meaning attribute.
@x ,  @y  are examples.

Class variables
Variables which begin with double at symbols are class variables. class variables give an attribute to many related objects in Ruby. Think of the double at prefix as meaning attribute all.
@@x ,  @@y  are examples.