Re: Re: Why is 'else' demanded?

Andrew Luo <[email protected]> Thu, 13 Jun 2013 20:39:57 -0700 (PDT)
Newsgroups gmane.comp.programming.refactoring
Message-ID <[email protected]>
You don'tneed else,=C2=A0

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 helpful =
to have else to make things more succinct. =C2=A0Don't use it if you don't =
like it, but your code may become more awkward for others to read.

- Andrew


________________________________
 From: zhanghongliang <[email protected]>
To: refactoring <[email protected]>=20
Sent: Wednesday, June 12, 2013 8:39 PM
Subject: Re: Re: [refactoring] Why is 'else' demanded?
=20


=C2=A0=20
May the explanation is forceful as below:=20

refactoring starts with "structured programming" (the=20
paradigm shift in the 1980s where "if - go to" statements were replaced=20
by "while", "repeat" and "if-then-else" statements in a lot of=20
languages). The return statement is not part of a structured program.=20

the above drawn from the reply mail by Willem Bogaerts<[email protected]>=20




Best regards,=20
ZhangHong-liang=20



=E5=BC=A0=E7=BA=A2=E4=BA=AE=20

M:18640223030=20
DL: 010=EF=BC=8D82870058=20
=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)=20
=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)=20
Fax:82870098=20


From: Carfield Yim=20
Date: 2013-06-10 23:34=20
To: refactoring=20
Subject: Re: [refactoring] Why is 'else' demanded?=20

I think one reason is C have if-else and quite a number of languages base=20
on C.=20

On Mon, Jun 10, 2013 at 3:02 AM, =E5=BC=A0=E7=BA=A2=E4=BA=AE <zhanghonglian=
[email protected]> wrote:=20

> I have a problem. Why is there always else key word in a language? Since =
I=20
> can use return to stop the process of a flow. I hate to see else statemen=
t=20
> and I see I can never use else statement that only increase the complexit=
y=20
> of program.=20
>=20
> A if statement stands for a condition that should be unique, and it shoul=
d=20
> has no relation with anything else. So a language does not need else and =
it=20
> should not appear in a program.=20
>=20
> Sent from my iPad=20
>=20
>=20
> ------------------------------------=20
>=20
> Yahoo! Groups Links=20
>=20
>=20
>=20
>=20

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



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


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