TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
Epic Answer - Avoiding If statements
9 points
by
sidmkp96
about 12 years ago
3 comments
yen223
about 12 years ago
Collapse
It's easy - use switch/case statements!<p>But seriously, isn't it true that Smalltalk doesn't have if statements?
评论 #5400431 未加载
andymoe
about 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>
amccloud
about 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.