Category:Smalltalk: Difference between revisions
Content added Content deleted
Line 653: | Line 653: | ||
]</lang> |
]</lang> |
||
However, both are incompatible and not supported by most other dialects, which use the |
However, both are incompatible and not supported by most other dialects, which use the historic Smalltalk-80 chunk format: |
||
<lang smalltalk>!Number methodsFor:'math'! |
<lang smalltalk>!Number methodsFor:'math'! |
||
my_factorial |
my_factorial |
||
^ (self < 2) ifTrue:[1] ifFalse:[ self * (self-1) my_factorial] |
^ (self < 2) ifTrue:[1] ifFalse:[ self * (self-1) my_factorial] |
||
! !</lang> |
! !</lang> |
||
This chunk format is supported by all systems, but it is somewhat ugly to read and also needs exclamation marks to be doubled (which looks especially bad in string literals). |
|||
So in which dialect's fileOut format should the example be presented to be most convenient, readable, and to be repeatable in case someone wants to try Smalltalk? |
So in which dialect's fileOut format should the example be presented to be most convenient, readable, and to be repeatable in case someone wants to try Smalltalk? |