[Cuis-dev] unnecessary punctuation

Mark Volkmann r.mark.volkmann at gmail.com
Wed Jun 12 06:56:07 PDT 2024


I saw this example in a YouTube video about Smalltalk this morning:

(2 > 3) ifTrue: ['Yes'] ifFalse: ['No']

It seems to me that none of the parentheses or square brackets are needed
here.
The following works the same for me.

2 > 3 ifTrue: 'Yes' ifFalse: 'No'

Is it true that keyword messages that take no-arg blocks can always take a
literal value instead?
It seems this works because the `Object` class defines the `value` method
to just return `self`.

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240612/d7219220/attachment.htm>


More information about the Cuis-dev mailing list