TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Epic Answer - Avoiding If statements

9 pointsby sidmkp96about 12 years ago

3 comments

yen223about 12 years ago
It's easy - use switch/case statements!<p>But seriously, isn't it true that Smalltalk doesn't have if statements?
评论 #5400431 未加载
andymoeabout 12 years ago
His idea in the second edit is similar to what is done with a lot of methods in Cocoa and Cocoa Touch and so on: <a href="http://cocoadev.com/wiki/MethodSwizzling" rel="nofollow">http://cocoadev.com/wiki/MethodSwizzling</a>
amccloudabout 12 years ago
Wouldn't that be considered a state machine? I've done something with an audio player. Each state was a different class.