Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29600

Re: in1To10

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
From Marcel Mueller <news.5.maazl@spamgourmet.org>
Newsgroups comp.lang.java.programmer
Subject Re: in1To10
Date Sat, 09 Aug 2014 22:56:23 +0200
Organization albasani.net
Lines 19
Message-ID <ls61to$agh$1@news.albasani.net> (permalink)
References <0c8de66a-429a-4697-b575-35f37a7b6882@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net UZAiNSOu+9JQwhaJauXeeFG55Zwplh8hqlcrq0K41qImA5cKbQpfa7YYc888ALO5wiZ/XbySSGX/eIfLFdrNXg==
NNTP-Posting-Date Sat, 9 Aug 2014 20:56:24 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="eiBWDTJ2y9CGPDaCn4C8KnE2X8s3Z43y7hOTytlxqQKgHEGUpt/4xhXxc1xl6unWgzMzgm+86qU/jS39fxrJCizOjlCUOQjHGM6fCtMdm+ejIx1lA9evH+bx3SIhPCFa"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (OS/2; Warp 4.5; rv:10.0.5) Gecko/20120625 Thunderbird/10.0.5
In-Reply-To <0c8de66a-429a-4697-b575-35f37a7b6882@googlegroups.com>
Cancel-Lock sha1:Shdg72hFgJSMVNHzHvameANLhig=
Xref csiph.com comp.lang.java.programmer:29600

Show key headers only | View raw


On 09.08.14 21.12, cdalten@gmail.com wrote:
> Now upon googling the solutions, I saw some people use
> if(outsideMode == false)
> if(outsideMode == true)
>
> instead of using if(outsideMode == false)/else(outsideMode == true).
>
> Would both catch all the cases? If not, which one would?

There is almost always more than one solution for a given problem.
Since booleans can only be true or false the second if (after else) is 
superfluous. And you also could simply write
   return (n >= 1 && n <= 10) ^ outsideMode;

The solutions might differ in execution speed or code length and style 
but as long this is not part of the task it makes no difference.


Marcel

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

in1To10 cdalten@gmail.com - 2014-08-09 12:12 -0700
  Re: in1To10 Jeff Higgins <jeff@invalid.invalid> - 2014-08-09 15:58 -0400
  Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-09 16:13 -0400
  Re: in1To10 Marcel Mueller <news.5.maazl@spamgourmet.org> - 2014-08-09 22:56 +0200
    Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-09 17:02 -0400
      Re: in1To10 Marcel Mueller <news.5.maazl@spamgourmet.org> - 2014-08-09 23:43 +0200
        Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-09 19:49 -0400
        Re: in1To10 Torsten Kirschner <torsten@kirschner.no> - 2014-08-10 16:59 +0200
          Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-10 11:33 -0400
            Re: in1To10 Torsten Kirschner <torsten@kirschner.no> - 2014-08-11 22:23 +0200
            Re: in1To10 Gene Wirchenko <genew@telus.net> - 2014-08-12 11:10 -0700
              Re: in1To10 Arne Vajhøj <arne@vajhoej.dk> - 2014-08-19 16:54 -0400
                Re: in1To10 Gene Wirchenko <genew@telus.net> - 2014-08-20 10:36 -0700
            Re: in1To10 Arne Vajhøj <arne@vajhoej.dk> - 2014-08-19 16:53 -0400
  Re: in1To10 cdalten@gmail.com - 2014-08-09 18:35 -0700
    Re: in1To10 Jeff Higgins <jeff@invalid.invalid> - 2014-08-09 22:13 -0400
    Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-09 22:23 -0400
    Re: in1To10 Jeff Higgins <jeff@invalid.invalid> - 2014-08-10 12:07 -0400
  Re: in1To10 Mike Amling <mamling@chaff.us> - 2014-08-10 00:29 -0500
  Re: in1To10 "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-08-10 13:53 +0100
    Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-10 09:48 -0400
      Re: in1To10 "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-08-10 15:01 +0100
        Re: in1To10 Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-10 10:32 -0400
          Re: in1To10 "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-08-10 15:53 +0100
  Re: in1To10 lipska the kat <lipskathekat@example.com> - 2014-08-10 14:07 +0100
  Re: in1To10, a simple test plan lipska the kat <lipskathekat@example.com> - 2014-08-10 16:43 +0100
    Re: in1To10, a simple test plan Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-10 12:01 -0400
      Re: in1To10, a simple test plan lipska the kat <lipskathekat@example.com> - 2014-08-10 17:41 +0100
      Re: in1To10, a simple test plan Arne Vajhøj <arne@vajhoej.dk> - 2014-08-19 16:57 -0400
  Re: in1To10 Roedy Green <see_website@mindprod.com.invalid> - 2014-08-12 02:59 -0700

csiph-web