CSC/ECE 517 Summer 2008/wiki1 6 jm: Difference between revisions
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
{| border="1" cellpadding="4" | {| border="1" cellpadding="4" | ||
|-valign="top" | |-valign="top" | ||
|width=" | |width="10%"|'''Hashtable Function''' | ||
|width=" | |width="45%"|'''Ruby''' | ||
|width=" | |width="45%"|'''Java''' | ||
|- | |- | ||
| | |'''Create''' | ||
|<code>h = {}</code> or | |<code>h = {}</code> or | ||
<code>h = Hash.new</code> | <code>h = Hash.new</code> | ||
|<code> TO DO </code> | |<code> TO DO </code> | ||
|- | |- | ||
|'''Initialize''' | |||
|<code>h = {"key1" => "value1", "key2" => "value2" } | |||
| TO DO | |||
{| | {| |
Revision as of 16:50, 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"]
Hashes in Java
Arrays in Java
Hashtable Function | Ruby | Java | |
Create | h = {} or
|
TO DO
| |
Initialize | h = {"key1" => "value1", "key2" => "value2" }
|
TO DO
|