[Newbies] Re: if absent put nil (Riaan)

2008-08-06 Thread Klaus D. Witzel

On Wed, 06 Aug 2008 13:47:39 +0200, Riaan van Aarde 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.


You can assign subexpression (self workSession attendees) to a temporary  
variable wsa and after the statement (wsa #do: ...) have another statement  
like this
  wsa ifEmpty ifTrue: [what you would like to do if there is no  
attendees].


HTH.

/Klaus


Please assist.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 05 August 2008 07:33 PM
To: beginners@lists.squeakfoundation.org
Subject: Beginners Digest, Vol 28, Issue 6

Send Beginners mailing list submissions to
beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Beginners digest...


Today's Topics:

   1. true/false defined where? (Sean Allen)
   2. Re: true/false defined where? (Derek O'Connell)
   3. Re: true/false defined where? (Michael Rueger)
   4. Re: true/false defined where? (Sean Allen)
   5. Re: true/false defined where? (Randal L. Schwartz)
   6. Re: true/false defined where? (Sean Allen)
   7. Re: Problems getting started with OpenGL in Squeak (Ken G. Brown)
   8. Fighting again with MC (Giuseppe Luigi Punzi)


--

Message: 1
Date: Tue, 5 Aug 2008 08:48:24 -0400
From: Sean Allen [EMAIL PROTECTED]
Subject: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed

where do true and false spring into existence?

i've been poking around and cant figure it out.



--

Message: 2
Date: Tue, 5 Aug 2008 13:53:18 +0100
From: Derek O'Connell [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

Have a look in Kernel-Objects

On Tue, Aug 5, 2008 at 1:48 PM, Sean Allen [EMAIL PROTECTED]
wrote:

where do true and false spring into existence?

i've been poking around and cant figure it out.

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




--

Message: 3
Date: Tue, 05 Aug 2008 14:54:45 +0200
From: Michael Rueger [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Sean Allen wrote:

where do true and false spring into existence?


They have been around longer than some people on this mailing list ;-)


i've been poking around and cant figure it out.



true and false and some of the very few objects known to the VM and they
where instantiated when the parent of all current images was created.
All images are basically cloned and not re-created from source, and
that's why you don't see any initialization code for them, they just  
are.


Hope this doesn't add to any confusion...

Michael


--

Message: 4
Date: Tue, 5 Aug 2008 09:09:01 -0400
From: Sean Allen [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Aug 5, 2008, at 8:54 AM, Michael Rueger wrote:


Sean Allen wrote:

where do true and false spring into existence?


They have been around longer than some people on this mailing list ;-)


i've been poking around and cant figure it out.



true and false and some of the very few objects known to the VM and
they where instantiated when the parent of all current images was
created.
All images are basically cloned and not re-created from source, and
that's why you don't see any initialization code for them, they just
are.

Hope this doesn't add to any confusion...


How is this for a confusing answer... it both 

[Newbies] Re: if absent put nil (Riaan)

2008-08-06 Thread Zulq Alam
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