-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek3_technical_blog.html
36 lines (36 loc) · 1.79 KB
/
week3_technical_blog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DODTYPE html>
<head>
<title>Arrays vs. Hashes</title>
<link rel="stylesheet" type="text/css" href="stylesheets/my_style.css">
</head>
<body>
<header>
<h1>Arrays vs. Hashes</h1>
<h3 id="date">March 27, 2014</p>
</header>
<main>
<article class="blog">
<p></p>
<h4>What are they?</h4>
<p>
Both arrays and hashes store collection of objects, and these objects are accessible by its key. In another words, arrays and hashes act like a list of objects where each object has its own idenification called 'key'.<br>
A big differenve between them is that the objects in arrays are indexed with numbers(integers) according to their positions. Simply put, the first object in an array is indexed '0', the second is '1', the third is '3' and so forth.
Objects in hashes on the other hand, are identified with an object. And these objects can be any type (strings, symbols, intergers and so on).
</p>
<h4>What are they good for?</h4>
<p>
Arrays are good to store ordered information.<br>
Hashes are good to store some data and retrieving it quickly.
</p>
<h4>Which one to use</h4>
<p>
If you need to store a set of information in a particular order and be able to manipulate it later on, arrays will be very useful. They are easy to iterate thorough and there are lots of method available to transform each object.
If you on the other hand, want to store information in a way that it'll be easier for you to access them easily later on, you want to use hashes. You can organize them in groups, and lebel them however you want, so it will be very easy to call a specific object on the fly.
</p>
</article>
<p id="back"><a href="http://smileyface525.github.io">Go back to the main page</a></p>
</main>
<footer>
<p id="footer">Created by Eiko Seino</p>
</footer>
</body>