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
One Line If
Search
Vinicius Gomes
July 01, 2014
Programming
0
340
One Line If
Based on this blog post:
http://vvgomes.com/one-line-if/
Vinicius Gomes
July 01, 2014
Tweet
Share
More Decks by Vinicius Gomes
See All by Vinicius Gomes
Golpes e Fraudes Bancárias
vvgomes
0
41
Monitoramento de SEO com Cloud Functions
vvgomes
0
33
Thinking Event Driven Architectures with Serverless
vvgomes
0
1.9k
Quando Microserviçoes Encontram Event Sourcing
vvgomes
0
270
Arquitetura Orientada a Eventos no mundo Serverless
vvgomes
0
430
When Microservices Meet Event Sourcing
vvgomes
6
1.3k
When Microservices met Event Sourcing
vvgomes
1
590
Feature Leads
vvgomes
1
780
As Melhores Práticas na Condução de Entrevistas Técnicas
vvgomes
0
630
Other Decks in Programming
See All in Programming
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.2k
あなたの知らない「動画広告」の世界 - iOSDC Japan 2025
ukitaka
0
420
dynamic!
moro
9
6.8k
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
750
Playwrightはどのようにクロスブラウザをサポートしているのか
yotahada3
7
2.3k
ててべんす独演会〜Flowの全てを語ります〜
tbsten
1
220
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
210
Reduxモダナイズ 〜コードのモダン化を通して、将来のライブラリ移行に備える〜
pvcresin
2
690
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
180
どの様にAIエージェントと 協業すべきだったのか?
takefumiyoshii
2
620
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
380
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
170
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
4 Signs Your Business is Dying
shpigford
185
22k
Faster Mobile Websites
deanohume
310
31k
Git: the NoSQL Database
bkeepers
PRO
431
66k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Building Adaptive Systems
keathley
43
2.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Gamification - CAS2011
davidbonilla
81
5.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
How to Think Like a Performance Engineer
csswizardry
27
2k
How to train your dragon (web standard)
notwaldorf
96
6.3k
Transcript
one line if
Why? • Improve reading effectiveness • Improve maintenance
Motivation • Cyclomatic complexity • Mental stack limitations
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } };
None
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } };
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } };
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } }; hit
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } };
this.guess = function(letter) { if(hiddenWord.reveal(letter)) { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You
Kick Asses!'); nextLevel(); } } else { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } } }; mistake
this.guess = function(letter) { if(hiddenWord.reveal(letter)) hit(); else mistake(); }; var
hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } };
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } };
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } };
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } }; win
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } };
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) { alert('You Kick Asses!'); nextLevel(); } }; var mistake = function() { image.showNext(); if(--chances == 0) { alert('Looooser!'); gameOver(); } }; lose
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); if(hiddenWord.isEverythingRevealed()) win(); }; var mistake = function() { image.showNext(); if(--chances == 0) lose(); }; var win = function() { alert('You Kick Asses!'); nextLevel(); }; var lose = function() { alert('Looooser!'); gameOver(); };
this.guess = function(letter) { hiddenWord.reveal(letter) ? hit() : mistake(); };
var hit = function() { hiddenWord.render(); win.when(hiddenWord.isEverythingRevealed()); }; var mistake = function() { image.showNext(); lose.when(--chances == 0) }; var win = function() { alert('You Kick Asses!'); nextLevel(); }; var lose = function() { alert('Looooser!'); gameOver(); };
None