Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Conditional (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Object-oriented implementation in Smalltalk === In contrast to other languages, in [[Smalltalk]] the conditional statement is not a [[language construct]] but defined in the class <code>Boolean</code> as an abstract method that takes two parameters, both [[Closure (computer science)|closure]]s. <code>Boolean</code> has two subclasses, <code>True</code> and <code>False</code>, which both define the method, <code>True</code> executing the first closure only, <code>False</code> executing the second closure only.<ref name="Smalltalk conditionals">{{cite web |url = http://wiki.cs.uiuc.edu/VisualWorks/Conditional+Processing |title = VisualWorks: Conditional Processing |date = 2006-12-16 |access-date = 2007-09-09 |archive-url = https://web.archive.org/web/20071022201949/http://wiki.cs.uiuc.edu/VisualWorks/Conditional+Processing |archive-date = 2007-10-22 |url-status = dead }}</ref> <syntaxhighlight lang="smalltalk"> var = condition ifTrue: [ 'foo' ] ifFalse: [ 'bar' ] </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)