I would probably do as Klaus suggests but you could also use a cascade and then #ifEmpty:. For example:

self workSession attendees
  do: [:each | html text: each person displayString]
    separatedBy: [html text: '; '] ;
  ifEmpty: [html text: 'NO ATTENDEES']  

Note the cascade ";" at the end of the third line. This sends #do:seperatedBy: and then sends #ifEmpty: to the collection returned by #attendees. Of course, #ifEmpty: and #do:separatedBy: will only do something if the collection is either empty or not.

Regards,
Zulq.

Riaan van Aarde (SpeCon Eng.) wrote:
I have the following code

renderAttendeesOn: html
        self workSession attendees do: [:each | html text: each person
displayString] separatedBy: [html text:'; '.]

if there is no attendees for my worksession, it needs to display : NO
ABSENTEES.

Please assist.


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to