| and & make sure that each expression between them is executed - so it will do each of:
   a date  > b date
and 
   a date = b date
and
   a date > temps > b date temps

This matters if one of these is significantly slower than the others - it will run it even it it doesn't need too.  Also if any side-effects are in one of these expressions, this will make that side effect happen (there aren't any in these, though).

and: and or: stop executing as soon as one of them is satisfied sufficiently - so if a date > b date then it will immediately return true without bothering with the rest of the expressions.
ifTrue:ifFalse: is similar - except you will evaluate the condition expression AND one of the following expressions.

Often this doesn't matter one way or another - but when it does, it matters a lot.

-cbc

On Wed, Feb 4, 2015 at 9:00 AM, Paul DeBruicker <pdebruic@gmail.com> wrote:
Does using the | or & notation have any advantages over and: or or:  or
ifTrue:ifFalse ?


I always write expressions like the one you've written like:

a date = b date
   ifTrue:[a temps > b temps]
   ifFalse:[a date > b date]







Louis LaBrunda wrote
> Hi Raymond,
>
> Try:
>
> ^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
> temps > b date temps))].
>
> Lou
>
> On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin &lt;

> jgr.asselin@

> &gt;
> wrote:
>
>>I have this kind of sorting on anOrderedCollection
>>
>>BlocNotes >>sortedNotes
>>      ^notes sorted:[:a :b | a date  > b date]
>>
>>This sort my notes on date but I want them sort by date AND inside a date
by hours and I don't khow how to do this.
>>
>>Some insights?
>>
>>aNote = 'med com date temps' instancesVariables what I call hours = temps
witch is a number like 2123 for 21h23
>>
>>Some insights?
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:

> Lou@

http://www.Keystone-Software.com
>
> _______________________________________________
> Beginners mailing list

> Beginners@.squeakfoundation

> http://lists.squeakfoundation.org/mailman/listinfo/beginners





--
View this message in context: http://forum.world.st/How-to-doubble-sort-a-collection-tp4803657p4803671.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners