Re: Re: Why is 'else' demanded?

Steven Gordon <[email protected]> Thu, 13 Jun 2013 22:35:46 -0700
Newsgroups gmane.comp.programming.refactoring
Message-ID <CAF7qo6UvomSq8rgbC=FDTv15PhiQKH9kWauLxPRBCfHcNwumHQ@mail.gmail.com>
Awkward code has much a greater cost of ownership.

On Thu, Jun 13, 2013 at 8:39 PM, Andrew Luo <[email protected]> wrote:

> **
>
>
> You don'tneed else,
>
> if evaluation
> ...
> else
> ...
>
> is equivalent to
>
> istrue =3D evaluation
>
> if istrue
> ....
> if !istrue
> ....
>
> but it's likely that this idiom was so common that people found it helpfu=
l
> to have else to make things more succinct.  Don't use it if you don't lik=
e
> it, but your code may become more awkward for others to read.
>
> - Andrew
>
> ________________________________
> From: zhanghongliang <[email protected]>
> To: refactoring <[email protected]>
> Sent: Wednesday, June 12, 2013 8:39 PM
> Subject: Re: Re: [refactoring] Why is 'else' demanded?
>
>
>
> May the explanation is forceful as below:
>
> refactoring starts with "structured programming" (the
> paradigm shift in the 1980s where "if - go to" statements were replaced
> by "while", "repeat" and "if-then-else" statements in a lot of
> languages). The return statement is not part of a structured program.
>
> the above drawn from the reply mail by Willem Bogaerts<[email protected]>
>
> Best regards,
> ZhangHong-liang
>
> =D5=C5=BA=EC=C1=C1
>
> M:18640223030
> DL: 010=A3=AD82870058
> =C9=CF=BA=A3=C0=D7=CC=DA=C8=ED=BC=FE=D3=D0=CF=DE=B9=AB=CB=BE (ShangHai Ra=
xtone Limited Company)
> =B1=B1=BE=A9=CA=D0=BA=A3=B5=ED=C7=F8=D6=D0=B9=D8=B4=E5=B2=CA=BA=CD=B7=BB=
=C2=B711=BA=C5=BB=AA=D2=BB=BF=D8=B9=C9=B4=F3=CF=C3201=CA=D2 (Room 201, Buli=
ding HuaYi control, No.11,
> CaiHeFang Road, Beijing , China)
> Fax:82870098
>
> From: Carfield Yim
> Date: 2013-06-10 23:34
> To: refactoring
> Subject: Re: [refactoring] Why is 'else' demanded?
>
> I think one reason is C have if-else and quite a number of languages base
> on C.
>
> On Mon, Jun 10, 2013 at 3:02 AM, =D5=C5=BA=EC=C1=C1 <zhanghongliang@raxto=
ne.com> wrote:
>
> > I have a problem. Why is there always else key word in a language? Sinc=
e
> I
> > can use return to stop the process of a flow. I hate to see else
> statement
> > and I see I can never use else statement that only increase the
> complexity
> > of program.
> >
> > A if statement stands for a condition that should be unique, and it
> should
> > has no relation with anything else. So a language does not need else an=
d
> it
> > should not appear in a program.
> >
> > Sent from my iPad
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
>=20=20
>


[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/refactoring/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected]=20
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/