Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Symbols and Hashes Intro
Search
Saurabh Bhatia
April 25, 2013
Technology
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Symbols and Hashes Intro
Intro to Symbols and Hashes
Saurabh Bhatia
April 25, 2013
More Decks by Saurabh Bhatia
See All by Saurabh Bhatia
Barrister RPC
thewub
0
470
RulingOrbit
thewub
0
390
Rails API
thewub
0
450
Cloud Primer
thewub
1
420
Other Decks in Technology
See All in Technology
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
Kiro WebとCloud Sessions
nagisa53
2
180
案件に一番詳しいAIを Amazon Bedrock AgentCore で作る ― 知見が知見を生むチームへ / Compounding Knowledge with AgentCore
yusukeshimizu
1
180
dbt と Snowflake と tag
kevinrobot34
1
210
Android skills に学ぶ
kokiko
0
170
強化学習「理論」入門
enakai00
3
3.6k
8bit CPU 2026
koba789
7
2.7k
:syncing_time:
sksat
2
660
20260817_生成AIの動向と中学校・高等学校での活用を考える_v1.00_公開用
doradora09
PRO
0
210
関東Kaggler会発表資料
takoi
1
290
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
140
内製AIチャットボット開発で学んだ Datadog Agent Observability活用術
mkdev10
0
130
Featured
See All Featured
Everyday Curiosity
cassininazir
0
290
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
380
Site-Speed That Sticks
csswizardry
13
1.5k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.4k
Become a Pro
speakerdeck
PRO
31
6.2k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
350
4 Signs Your Business is Dying
shpigford
187
23k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Transcript
Strings and Hashes
What is it ? • Symbol is something used to
represent a string. • A more memory efficient and descriptive way to do things.
How does it look ? Colon followed by a non-quoted
string - :symbol Or Colon followed by quoted string - :'this is another symbol'
Assigning stuff to symbols • :my_symbol = “foo_bar” - wrong
• my_symbol = :foo_bar – right • attr_accessor :foo_bar • my_symbol = :foo_bar.to_s
Symbols are immutable
hash • Data structure – collection of key value pairs
• Indexing via keys of object _type • Randomly ordered
What does it look like ? • animals = Hash.new
• animals["dog"] = "bark" • pry(main)> animals => {"dog"=>"bark", "cat"=>"purr"}
• Iterating over an array • animal_farm.each do |a| puts
a end • Iterating over a hash • animals.each do |k,v| puts “#{k} and #{v} end
exercise • Create a hash to represent currencies eg USA
=> usd , UK => gbp, JAPAN => yen • Display all the currencies • Replace all the name of countries with their short codes eg US -> US, JAPAN –> JP, UK -> UK
Solution • currencies = { “USA” => “usd” , “UK”
=> “gbp”, “JAPAN” => “yen” } • new_currencies = {"US" => "usd", "UK" => "gbp", “JP” => “yen”} • Hash[currencies.map {|k, v| [new_currencies[k], v] }]