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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Saurabh Bhatia
April 25, 2013
Technology
65
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
460
RulingOrbit
thewub
0
390
Rails API
thewub
0
450
Cloud Primer
thewub
1
420
Other Decks in Technology
See All in Technology
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
210
AIのReact習熟度を測る
uhyo
2
180
AIソロプレナー時代に2ヶ月で20人増員した事業創造会社の開発組織の話
miyatakoji
0
600
非エンジニアがClaudeと挑んだ「1ヶ月間プロダクト30本ノック」
askokc
0
350
ACE-Step-1.5で見る 音楽生成AIのしくみと“破綻だけ直す”Retake機能の開発【zennfes spring 2026 登壇資料】
personabb
1
140
AAIFに入ってみた ~内から見えるコミュニティ動向~
sato4
0
160
Snowflakeと仲良くなる第一歩
coco_se
4
430
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
1.9k
データサイエンスを価値につなげるプロジェクト設計 〜 DS一年目が現場で得た気づき 〜
ysd113
1
190
Disciplined Vibes: Scaling AI-Assisted Engineering
sheharyar
0
130
エンジニアリング戦略の作り方 / Crafting Engineering Strategy
iwashi86
20
6.6k
Chainlitで作るお手軽チャットUI
ynt0485
0
200
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
140
KATA
mclloyd
PRO
35
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
390
Skip the Path - Find Your Career Trail
mkilby
1
140
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Mobile First: as difficult as doing things right
swwweet
225
10k
Designing for humans not robots
tammielis
254
26k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
230
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] }]