CSC/ECE 517 Summer 2008/wiki1 6 jm: Difference between revisions
Jump to navigation
Jump to search
Line 34: | Line 34: | ||
|todo | |todo | ||
|- | |- | ||
|'''Element Access''' | |||
|<code>h[0]</code> | |||
|<code>h[0]<code> | |||
{| | {| | ||
Revision as of 18:17, 6 June 2008
Introduction
Both Ruby and Java support arrays and hash tables
Hashes in Ruby
Arrays in Ruby
Creating Arrays in Ruby
Creating an array in Ruby is as simple as
a = []
Initializing an Array in Ruby
a = ["one",45,"hello"]
Array Comparison
Array Function | Ruby | Java | |||||||||||||||||||||||||
Create | h = [] or
|
todo | |||||||||||||||||||||||||
Initialize | h = ["one",1,"two"] | todo | |||||||||||||||||||||||||
Element Access | h[0]
|
h[0] |