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 Newsgroups: comp.lang.java.programmer Subject: Re: in1To10 Date: Sat, 09 Aug 2014 22:56:23 +0200 Organization: albasani.net Lines: 19 Message-ID: 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 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