Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

RE: RE: shortest

by myocom (Deacon)
on Sep 17, 2000 at 02:50 UTC ( #32842=note: print w/replies, xml ) Need Help??

in reply to RE: shortest
in thread shortest

Perhaps it's me, but this doesn't seem to produce the expected results... It reports 'odd' for every digit except '1'.

Replies are listed 'Best First'.
RE: (3) shortest
by Adam (Vicar) on Sep 18, 2000 at 19:36 UTC
    Yup. Actually Its worse then that. Try using a number with a zero in it. It stops at the zero. I guess I should have run it instead of just trusting that it would work. (I'll try to re-write it to make it work, and I'll post the current, bad, version here so that other's will understand the mistake.)
    chop($_=<>);print "\n$a: ",$a>>1?'odd':'even' while $a=chop; # The above snipit does not work. # When I posted it, I was thinking that the bit shift >> # would return the bit shifted off the end, but of course, # sanity eventualy prevailed and I realized that it does # not do that. (duh!) # Additionally, it has a bug in that it stops on the first # zero in the number. # # TEST TEST TEST!!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://32842]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-06-23 05:49 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (536 votes). Check out past polls.