$30 off During Our Annual Pro Sale. View Details »
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
350
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
47
Monitoramento de SEO com Cloud Functions
vvgomes
0
41
Thinking Event Driven Architectures with Serverless
vvgomes
0
1.9k
Quando Microserviçoes Encontram Event Sourcing
vvgomes
0
280
Arquitetura Orientada a Eventos no mundo Serverless
vvgomes
0
440
When Microservices Meet Event Sourcing
vvgomes
6
1.3k
When Microservices met Event Sourcing
vvgomes
1
600
Feature Leads
vvgomes
1
800
As Melhores Práticas na Condução de Entrevistas Técnicas
vvgomes
0
650
Other Decks in Programming
See All in Programming
Navigating Dependency Injection with Metro
l2hyunwoo
1
120
認証・認可の基本を学ぼう後編
kouyuume
0
240
Cell-Based Architecture
larchanjo
0
130
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
認証・認可の基本を学ぼう前編
kouyuume
0
260
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.1k
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.9k
Developing static sites with Ruby
okuramasafumi
0
310
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
730
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
150
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
240
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
120
Featured
See All Featured
Writing Fast Ruby
sferik
630
62k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
58
Faster Mobile Websites
deanohume
310
31k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
500
How Software Deployment tools have changed in the past 20 years
geshan
0
29k
Color Theory Basics | Prateek | Gurzu
gurzu
0
140
Mobile First: as difficult as doing things right
swwweet
225
10k
Building Applications with DynamoDB
mza
96
6.8k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
120
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
0
270
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
860
Rails Girls Zürich Keynote
gr2m
95
14k
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