Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

shortened if

Name: Suddenly, Bananas 2013-02-10 14:26

Do any languages allow you to shorten an if statement like this:
if (test == a || test == b || test == c || test == d)
to something like this:
[code]if (test == a || b || c || d)
?

Name: Anonymous 2013-02-10 17:52

[a, b, c, d].indexOf(test) >= 0

Name: Anonymous 2013-02-10 18:17

[code]if test in [a, b, c, d]:
    print 'FIOC wins again'

Name: Anonymous 2013-02-10 18:18

>>16
if test in [a, b, c, d]:
    print 'ONE WORD FORCED INDENTATION OF THE CODE /CODE'

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List