-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht4-arrays-hashes.html
More file actions
71 lines (46 loc) · 3.03 KB
/
t4-arrays-hashes.html
File metadata and controls
71 lines (46 loc) · 3.03 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Krystyna Ewing DBC</title>
<link href="blog-stylesheet.css" rel="stylesheet" type="text/css" />
</div>
</head>
<meta name="The DBC Experience" content="Blog and Portfolio of my experience at DBC"
<link rel="stylesheet" type="text/css" href="../CSS/blog-stylesheet.css">
</head>
<body>
<div class="wrapper">
<div class="top">
</div>
<ul class="navigation">
<li><a href="https://twitter.com/Wimsy113" title="Twitter">Twitter</a></li>
<li><a href="http://krystynaewing.wordpress.com" target="_blank" title="Wordpress">Wordpress</a></li>
<li><a href="Portfolio" title="Portfolio">Portfolio</a>
<ul>
<li><a href="http://t.co/MqlXzENMxk" target="_blank" title="Carbonmade">Carbonmade</a></li>
<li><a href="https://github.com/Wimsy113" target="_blank" title="Github">Github</a></li>
<li><a href="http://wimsy113.deviantart.com" target="_blank" title="Deviantart">Deviantart</a></li>
<li><a href="" title="Responsive webdesign">Responsive webdesign</a></li>
</ul>
</li>
<li><a href="http://www.linkedin.com/pub/krystyna-ewing/56/b41/48/" target="_blank" title="Linkedin">Linkedin</a></li>
<div class="clear"></div>
</ul>
<div id="content">
1
<h2>Array! Hashes! What???</h2>
<p> A hash or an array? Which one will you use? And how do you choose? Maybe knowing how they differ will set your mind aflame and will cause your head to explode with awe? Or maybe you'll learn something new.....either way.....</p>
<h2>Hashes</h2>
<p>According to ruby docs, a hash is collection of key-value pairs and the indexing is done via arbirary kieys of any object type, not just integers. Hashes values come from the order of which the corresponding keys were inserted. In other words, if you were a baseball coach trying to track how many hits each of your players get, the key would be the players name and the variable would be his hits per game. </p>
<h2>Arrays</h2>
<p>According to ruby docs, an array is an ordered, integer-indexed collections of any object. Array indexing starts at 0, (meaning the FIRST object in the array has the value of 0, the second object would have the value of 1 and so on and so fourth). Arrays can be used as lists, and their values are assigned based on object placement rather than keys and variables.</p>
<h2>Are they interchangeble?</h2>
<p>Well it depends on how much work you are willing to do, if something calls for a hash and you can do some magic to make an array work, just put the hash in there. Same thing with an array. Espeically if you are dealing with values. It becomes too confusing and too conveluted.</p>
</div>
<footer>
<iframe src="https://www.google.com/calendar/embed?src=krystyna.d.l.ewing%40gmail.com&ctz=America/New_York" style="border: 0" width="200" height="200" frameborder="0" scrolling="no"></iframe>
<button><a href ="mailto:[email protected]">Contact Me</a></button>
</footer>
</body>
</html>