Re: Re: Why is 'else' demanded?

zhanghongliang <[email protected]> Fri, 14 Jun 2013 17:49:44 +0800
Newsgroups gmane.comp.programming.refactoring
Message-ID <[email protected]>
Maybe you're right. Perhaps I devoted too much into defensive programming. =
If no nested conditional statements, if else combination is satisfactory.=
=0D
=0D
=0D
=0D
=0D
Best regards,=0D
ZhangHong-liang.=0D
=0D
=0D
=0D
=E5=BC=A0=E7=BA=A2=E4=BA=AE   =0D
=0D
M:18640223030=0D
DL: 010=EF=BC=8D82870058=0D
=E4=B8=8A=E6=B5=B7=E9=9B=B7=E8=85=BE=E8=BD=AF=E4=BB=B6=E6=9C=89=E9=99=90=E5=
=85=AC=E5=8F=B8 (ShangHai Raxtone Limited Company)=0D
=E5=8C=97=E4=BA=AC=E5=B8=82=E6=B5=B7=E6=B7=80=E5=8C=BA=E4=B8=AD=E5=85=B3=E6=
=9D=91=E5=BD=A9=E5=92=8C=E5=9D=8A=E8=B7=AF11=E5=8F=B7=E5=8D=8E=E4=B8=80=E6=
=8E=A7=E8=82=A1=E5=A4=A7=E5=8E=A6201=E5=AE=A4 (Room 201, Buliding HuaYi con=
trol, No.11, CaiHeFang Road, Beijing , China)=0D
Fax:82870098=0D
=0D
=0D
From: Andrew Luo=0D
Date: 2013-06-14 11:39=0D
To: [email protected]=0D
Subject: Re: Re: [refactoring] Why is 'else' demanded?=0D
  =0D
You don'tneed else, =0D
=0D
if evaluation=0D
...=0D
else=0D
...=0D
=0D
is equivalent to=0D
=0D
istrue =3D evaluation=0D
=0D
if istrue=0D
....=0D
if !istrue=0D
....=0D
=0D
but it's likely that this idiom was so common that people found it helpful =
to have else to make things more succinct.  Don't use it if you don't like =
it, but your code may become more awkward for others to read.=0D
=0D
- Andrew=0D
=0D
________________________________=0D
From: zhanghongliang <[email protected]>=0D
To: refactoring <[email protected]> =0D
Sent: Wednesday, June 12, 2013 8:39 PM=0D
Subject: Re: Re: [refactoring] Why is 'else' demanded?=0D
=0D
=0D
  =0D
May the explanation is forceful as below: =0D
=0D
refactoring starts with "structured programming" (the =0D
paradigm shift in the 1980s where "if - go to" statements were replaced =0D
by "while", "repeat" and "if-then-else" statements in a lot of =0D
languages). The return statement is not part of a structured program. =0D
=0D
the above drawn from the reply mail by Willem Bogaerts<[email protected]> =0D
=0D
Best regards, =0D
ZhangHong-liang =0D
=0D
=E5=BC=A0=E7=BA=A2=E4=BA=AE =0D
=0D
M:18640223030 =0D
DL: 010=EF=BC=8D82870058 =0D
=E4=B8=8A=E6=B5=B7=E9=9B=B7=E8=85=BE=E8=BD=AF=E4=BB=B6=E6=9C=89=E9=99=90=E5=
=85=AC=E5=8F=B8 (ShangHai Raxtone Limited Company) =0D
=E5=8C=97=E4=BA=AC=E5=B8=82=E6=B5=B7=E6=B7=80=E5=8C=BA=E4=B8=AD=E5=85=B3=E6=
=9D=91=E5=BD=A9=E5=92=8C=E5=9D=8A=E8=B7=AF11=E5=8F=B7=E5=8D=8E=E4=B8=80=E6=
=8E=A7=E8=82=A1=E5=A4=A7=E5=8E=A6201=E5=AE=A4 (Room 201, Buliding HuaYi con=
trol, No.11, CaiHeFang Road, Beijing , China) =0D
Fax:82870098 =0D
=0D
From: Carfield Yim =0D
Date: 2013-06-10 23:34 =0D
To: refactoring =0D
Subject: Re: [refactoring] Why is 'else' demanded? =0D
=0D
I think one reason is C have if-else and quite a number of languages base =
=0D
on C. =0D
=0D
On Mon, Jun 10, 2013 at 3:02 AM, =E5=BC=A0=E7=BA=A2=E4=BA=AE <zhanghonglian=
[email protected]> wrote: =0D
=0D
> I have a problem. Why is there always else key word in a language? Since =
I =0D
> can use return to stop the process of a flow. I hate to see else statemen=
t =0D
> and I see I can never use else statement that only increase the complexit=
y =0D
> of program. =0D
> =0D
> A if statement stands for a condition that should be unique, and it shoul=
d =0D
> has no relation with anything else. So a language does not need else and =
it =0D
> should not appear in a program. =0D
> =0D
> Sent from my iPad =0D
> =0D
> =0D
> ------------------------------------ =0D
> =0D
> Yahoo! Groups Links =0D
> =0D
> =0D
> =0D
> =0D
=0D
[Non-text portions of this message have been removed] =0D
=0D
[Non-text portions of this message have been removed]=0D
=0D
[Non-text portions of this message have been removed]=0D
=0D
=0D


[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/