CSC/ECE 517 Summer 2008/wiki1 6 jm: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 28: Line 28:
|width="40%"|'''Ruby'''
|width="40%"|'''Ruby'''
|width="40%"|'''Java'''
|width="40%"|'''Java'''
|-
|Create Hashtable '''h'''
|<code>h = {}</code> or
<code>h = Hash.new</code>
|<code> TO DO </code>
|-
{|
{|

Revision as of 16:44, 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 Hashtable h h = {} or

h = Hash.new

TO DO