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
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ruby-flip-flop
maimu
June 26, 2024
Transcript
20 slides
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
More Decks by maimu
See All by maimu
Gentoo 1年生 ビルドは終わらない
maimux2x
0
110
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
740
before_rails_girls_after_rails_girls
maimux2x
0
910
my_study_of_ruby_method
maimux2x
1
220
one_liner_fizzbuzz
maimux2x
0
190
about_rails_girls_document_translation
maimux2x
0
6.4k
best_for_fbc
maimux2x
0
94
homemade_service_release_front_and_back
maimux2x
0
530
Other Decks in Programming
See All in Programming
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
220
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
Будущее локальных LLM – Алексей Голобурдин, PythoNN
sobolevn
0
120
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
4.6k
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
340
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
240
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
170
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
330
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
290
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
320
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
180
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
660
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
350
From π to Pie charts
rasagy
1
450
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
The Curious Case for Waylosing
cassininazir
1
610
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Producing Creativity
orderedlist
PRO
348
41k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Designing for Performance
lara
612
70k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480