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
Ruby Quiz
Search
pocke
October 08, 2017
Programming
1
620
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
Tweet
Share
More Decks by pocke
See All by pocke
プログラミングで遊ぶ
pocke
0
99
Witchcraft for Memory
pocke
1
4.4k
The path to memory reduction in RBS
pocke
0
51
RBSのメモリ使用量改善への道
pocke
1
63
Community-driven RBS repository
pocke
2
1.5k
Active Record Query Quiz
pocke
1
1.6k
Let's write RBS!
pocke
1
5.2k
RBS and Rails, Present and Future
pocke
1
1.4k
The newsletter of RBS updates
pocke
1
3.5k
Other Decks in Programming
See All in Programming
CSC307 Lecture 09
javiergs
PRO
1
830
Architectural Extensions
denyspoltorak
0
270
MUSUBIXとは
nahisaho
0
130
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.3k
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2k
Fluid Templating in TYPO3 14
s2b
0
130
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
今から始めるClaude Code超入門
448jp
7
8.4k
dchart: charts from deck markup
ajstarks
3
990
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
440
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
140
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.1k
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
New Earth Scene 8
popppiees
1
1.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Speed Design
sergeychernyshev
33
1.5k
GraphQLとの向き合い方2022年版
quramy
50
14k
A better future with KSS
kneath
240
18k
4 Signs Your Business is Dying
shpigford
187
22k
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
120
Transcript
Ruby Quiz Oct. 8, 2017 第4回 学生エンジニア限定LT大会
I have only 5 minutes, so I'll speak very fast.
Self introduction • Pocke • Actcat, Inc. / SideCI •
RuboCop' s core developer • Student at The Open University of Japan
SideCI
Automated Code Review as a Service
Please access here! https://sideci.com
Ruby Quiz
Question
Do you write Ruby?
Ruby Quiz • You are a Ruby interpreter. ◦ You
are a parse.y. ◦ You are a YARV. • You execute ruby code, and you output result.
Quiz 1
Q. What does the code output? p(??) p(%_?_)
Answer p(??) # => "?" p(%_?_) # => "?"
Why?
A. Why does it output "?"? p(??) p(%_?_) %<any character>…<any
character> is a string literal. e.g.) %_?_ == "?" , %!???! == "???" ?_ is a character literal. e.g.) ?_ == "_" , ?? == "?"
Quiz 2
Q. What does the code output? p(????::?:) p(% %s% %%%%)
Answer p(????::?:) # => ":" p(% %s% %%%%) # =>
"%"
Why????
Answer p(????::?:) p(% %s% %%%%) 1. ?? is "?" 2.
? is a part of conditional op 3. ?: is ":" 4. : is a part of conditional op 5. ?: is ":" "?" ? ":" : ":" 1. % %s% is "%s%" 2. % is a format op(Like sprintf) 3. %%% is "" sprintf("%s%", "")
Quiz 3
Q. What does the code output? a = ["1","2","3"] a&.map(&:to_i)&.&([1])
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1]
Why?????
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1] &. is
a safe navigation op(nil guard). &:to_i is an implicit to_proc op. A safe navigation op & is an intersection op call (like [1,2,3] & [1])
Conclusion
• We can write tricky code in Ruby. ◦ Very
fun!!! Thank you for listening! Conclusion