Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ruby-flip-flop
Search
maimu
June 26, 2024
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ruby-flip-flop
maimu
June 26, 2024
More Decks by maimu
See All by maimu
Gentoo 1年生 ビルドは終わらない
maimux2x
0
100
Rails 1.0 のコードで学ぶ find_by* と method_missing の仕組み / Learn how find_by_* and method_missing work in Rails 1.0 code
maimux2x
1
1.5k
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
720
before_rails_girls_after_rails_girls
maimux2x
0
890
my_study_of_ruby_method
maimux2x
1
210
one_liner_fizzbuzz
maimux2x
0
180
about_rails_girls_document_translation
maimux2x
0
6.4k
best_for_fbc
maimux2x
0
88
homemade_service_release_front_and_back
maimux2x
0
520
Other Decks in Programming
See All in Programming
自分的「カンファレンスの楽しみ方」
syumai
0
200
Jetpack Compose メカニズム
skydoves
0
430
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
130
setup-vp GitLab対応の裏側
naokihaba
0
100
XHTMLが残したもの
yosuke_furukawa
PRO
2
800
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
400
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
710
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
340
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
710
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
240
アクセシビリティから考える情報設計
high_g_engineer
0
380
Webの地図
yosuke_furukawa
PRO
6
4.5k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Leo the Paperboy
mayatellez
10
2.3k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
230
Google's AI Overviews - The New Search
badams
0
1.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Building Applications with DynamoDB
mza
96
7.2k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
WENDY [Excerpt]
tessaabrams
14
39k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
520
Rails Girls Zürich Keynote
gr2m
96
14k
Transcript
Rubyのflip-flop と 仲良くなりたい 2024-06-26 maimu
自己紹介 名前:maimu(@maimux2x) 所属:永和システムマネジメント • フィヨルドブートキャンプ卒業生 • Rails Girls Tokyo 16th
オーガナイザー • 好きなRailsのメソッドはindex_by よろしくお願いします!
Rubyのflip-flopと仲良くなりたい
flip-flopとの出会い
ruby-jpで質問 ぺんさんが考え方を教えてくれた
「..」と「...」の違いが分からない
先ほどの実行例で確認してみる
るりまを見てみる https://docs.ruby-lang.org/ja/latest/doc/spec=2foperator.html 「..」の場合: 1. 初期状態では式1だけを評価し、式1が真を返 すまでは false を返します。 2. 式1が真を返すと
true を返します。式2が真な ら初期状態に戻ります。 3. この後は式2だけを評価し、式2が真を返すま で true を返します。 4. 式2が真を返すと true を返したあと、初期状態 に戻ります。 「...」の場合: 1. 初期状態では式1だけを評価し、式1が真を返 すまでは false を返します。 2. 式1が真を返すと true を返します。 3. この後は式2だけを評価し、式2が真を返すま で true を返します。 4. 式2が真を返すと true を返したあと、初期状態 に戻ります。
るりまのサンプルコードを実行
「..」の場合
「...」の場合
「..」と「...」の違い • 条件式1と条件式2が同じ内容である場合に結果に違いが発生する • 「..」の場合は「条件式に該当する結果」だけが得られる • 「...」の場合は「条件式に該当した結果から次に該当する結果まで」が得られる ◦ 次に該当する結果がなければ条件式に該当後から最後まで
やってみる self-introduction.mdを作成
「..」の場合
「...」の場合
やってみる② sample.mdを作成 るりまのサンプルコードを利用
「..」の場合
「...」の場合
チョット仲良くなれた!
参考資料 • https://docs.ruby-lang.org/ja/latest/doc/spec=2foperator.html • https://qiita.com/Ping/items/acb7fbb9aa141c2c46df