all is valid and a matter of style. You can also do this: ^ something aMsg ifNotNil:[ aNotherResult ] ifNil:[ something aMsg ]
or this: something aMsg ifNil:[ ^ something aMsg ]. ^ aNotherResult cheers, Esteban > On 30 Jun 2015, at 13:21, abdelghani ALIDRA <alidran...@yahoo.fr> wrote: > > Hi guys, > > what is the best way to express the following : > return (something aMsg) if it is not nil, return somethingElse elsewhere > > I could stil write: > > something aMsg > ifNil:[^ something aMsg] > ifNotNil:[^aNotherResult] > > but it sounds a little bit weird > > Regards. > > Abdelghani