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
590
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
Tweet
Share
More Decks by pocke
See All by pocke
Witchcraft for Memory
pocke
1
2.6k
The path to memory reduction in RBS
pocke
0
40
RBSのメモリ使用量改善への道
pocke
1
41
Community-driven RBS repository
pocke
2
1.3k
Active Record Query Quiz
pocke
1
1.4k
Let's write RBS!
pocke
1
5k
RBS and Rails, Present and Future
pocke
1
1.4k
The newsletter of RBS updates
pocke
1
3.4k
kwargs warning → Sentry
pocke
0
340
Other Decks in Programming
See All in Programming
0から始めるモジュラーモノリス-クリーンなモノリスを目指して
sushi0120
1
280
大規模FlutterプロジェクトのCI実行時間を約8割削減した話
teamlab
PRO
0
480
CEDEC 2025 『ゲームにおけるリアルタイム通信への QUIC導入事例の紹介』
segadevtech
3
890
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
7
2.9k
Portapad紹介プレゼンテーション
gotoumakakeru
1
130
新世界の理解
koriym
0
140
Webinar: AI-Powered Development: Transformiere deinen Workflow mit Coding Tools und MCP Servern
danielsogl
0
130
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
2
120
대규모 트래픽을 처리하는 프론트 개발자의 전략
maryang
0
120
LLMは麻雀を知らなすぎるから俺が教育してやる
po3rin
3
2.1k
STUNMESH-go: Wireguard NAT穿隧工具的源起與介紹
tjjh89017
0
370
令和最新版手のひらコンピュータ
koba789
13
7.8k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.5k
How GitHub (no longer) Works
holman
314
140k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Agile that works and the tools we love
rasmusluckow
329
21k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Speed Design
sergeychernyshev
32
1.1k
Balancing Empowerment & Direction
lara
2
570
Product Roadmaps are Hard
iamctodd
PRO
54
11k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Designing for humans not robots
tammielis
253
25k
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