www.webdeveloper.com
Results 1 to 2 of 2

Thread: will this determine an arguement as an odd number?

  1. #1
    Join Date
    Aug 2005
    Posts
    1

    will this determine an arguement as an odd number?

    pulic static boolean is Odd(int i) {
    return i % 2 ==1;
    }


    If not, Why?
    Last edited by cuda383; 08-26-2005 at 12:23 PM.

  2. #2
    Join Date
    Feb 2005
    Location
    USA
    Posts
    1,534
    Too much C? You don't declare functions like that in javaScript.

    The body of your code seems fine, though if you want it to work for negatives you will have to fix that part up too:

    Code:
    function isOdd(i){
    	return i%2==(i>0?1:-1);
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles