Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. That's one way to do it

That's one way to do it

Scheduled Pinned Locked Moved The Weird and The Wonderful
comhelp
64 Posts 38 Posters 37 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Daniel Pfeffer

    Me: Have Security dress the guy in a hazmat suit, and escort him out of the building. I'd then cordon off the area and decontaminate everything he touched on his visit - in an autoclave, by choice. This level of stupidity leaves traces wherever it goes.

    Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

    J Offline
    J Offline
    Jorgen Andersson
    wrote on last edited by
    #51

    Daniel Pfeffer wrote:

    I'd then cordon off the area and decontaminate everything he touched on his visit - in an autoclave, by choice

    Anything wrong with fire?

    Wrong is evil and must be defeated. - Jeff Ello

    K 1 Reply Last reply
    0
    • K Kent Sharkey

      GitHub - samuelmarina/is-even[^]

      Quote:

      This is a 100% serious project, and it is made to help the community.

      A brief excerpt:

      function isEven(number) {
      if(number === 1) return false;
      else if(number === 2) return true;
      else if(number === 3) return false;
      else if(number === 4) return true;
      else if(number === 5) return false;
      else if(number === 6) return true;
      else if(number === 7) return false;

      They're up to 1,000,001 now. Help them grow! :doh:

      TTFN - Kent

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #52

      Just what I was looking for! My own isEven function only goes to 1000, this is a huge step forward :D Just need to brace it properly and remove all those function exits...

      function isEven(number) {
      let result;
      if (number === 1) {
      result = false;
      }
      else if (number === 2) {
      result = true;
      }
      else if (number === 3) {
      result = false;
      }
      // ...
      return result;
      }

      And they have an is-odd package which is consistent with this one too. As programmers we know how important it is to be consistent. Thanks for this great find! :thumbsup: :-D

      Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

      1 Reply Last reply
      0
      • A atverweij

        That can be done better with a recursive function:

        function IsEven(number) {
        if (number === 1 return false;
        elseif (number === 2) return true;
        else return IsEven(number - 2);
        }

        Now it does all positive numbers :laugh: EDIT: because I get serious reactions on this code The code above is how NOT to do it - it's satire.

        K Offline
        K Offline
        kapalmuks 3
        wrote on last edited by
        #53

        hope your happy!!

        1 Reply Last reply
        0
        • M Member 9167057

          Well, if you troll, then you might just as well do it right, walking the walk way to the end.

          K Offline
          K Offline
          kapalmuks 3
          wrote on last edited by
          #54

          ..lead the way please.. ..you will be lost first.. 🤩🤩🤩🤩

          M 1 Reply Last reply
          0
          • A atverweij

            You are taking this code seriously?

            K Offline
            K Offline
            kapalmuks 3
            wrote on last edited by
            #55

            ..yes..is there anything else i should be serious about?.. 🤪🤪🤪🤪

            1 Reply Last reply
            0
            • N Nelek

              Now the question is... Is the one with that request trolling him? Or does he really needs it for his usage?

              M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

              K Offline
              K Offline
              kapalmuks 3
              wrote on last edited by
              #56

              ..got it perfectly..but are we on the same page? really?.. 😇😇😇😇

              1 Reply Last reply
              0
              • J Jorgen Andersson

                Daniel Pfeffer wrote:

                I'd then cordon off the area and decontaminate everything he touched on his visit - in an autoclave, by choice

                Anything wrong with fire?

                Wrong is evil and must be defeated. - Jeff Ello

                K Offline
                K Offline
                kapalmuks 3
                wrote on last edited by
                #57

                ..better be ready..you cant fight fire with fire.. ..you might be burned.. ..were you?.. 🤠🤠🤠🤠

                1 Reply Last reply
                0
                • K kapalmuks 3

                  ..lead the way please.. ..you will be lost first.. 🤩🤩🤩🤩

                  M Offline
                  M Offline
                  Member 9167057
                  wrote on last edited by
                  #58

                  That reminds me on that Simpsons episode. The boys hop into the caravan to steal back the lemon tree stolen by Shelbyvillians. After running through Shelbyville for basically ever, someone asks Homer, where he leads them. "I was following Flanders".

                  1 Reply Last reply
                  0
                  • K Kent Sharkey

                    GitHub - samuelmarina/is-even[^]

                    Quote:

                    This is a 100% serious project, and it is made to help the community.

                    A brief excerpt:

                    function isEven(number) {
                    if(number === 1) return false;
                    else if(number === 2) return true;
                    else if(number === 3) return false;
                    else if(number === 4) return true;
                    else if(number === 5) return false;
                    else if(number === 6) return true;
                    else if(number === 7) return false;

                    They're up to 1,000,001 now. Help them grow! :doh:

                    TTFN - Kent

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #59

                    Github has a file size limit. So if someone wants to max it out....

                    1 Reply Last reply
                    0
                    • J JohaViss61

                      It's at 94.8MB now

                      M Offline
                      M Offline
                      Matias Lopez
                      wrote on last edited by
                      #60

                      Don't waste my time, hahaha! :laugh:

                      1 Reply Last reply
                      0
                      • J Jon McKee

                        I... what?! I thought you were joking for a second but there actually is a definition for even and odd in generic bases. In even bases it's the last-digit test - odd is odd, even is even; in odd bases it's a test of the sum of all digits - odd is odd, even is even. That makes complete sense; it's just not something I've ever considered :omg:

                        D Offline
                        D Offline
                        den2k88
                        wrote on last edited by
                        #61

                        Ckuf me backwards with a shovel, it's the first time I hear this.

                        GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

                        1 Reply Last reply
                        0
                        • K Kent Sharkey

                          GitHub - samuelmarina/is-even[^]

                          Quote:

                          This is a 100% serious project, and it is made to help the community.

                          A brief excerpt:

                          function isEven(number) {
                          if(number === 1) return false;
                          else if(number === 2) return true;
                          else if(number === 3) return false;
                          else if(number === 4) return true;
                          else if(number === 5) return false;
                          else if(number === 6) return true;
                          else if(number === 7) return false;

                          They're up to 1,000,001 now. Help them grow! :doh:

                          TTFN - Kent

                          G Offline
                          G Offline
                          Gaston Verelst
                          wrote on last edited by
                          #62

                          They could even have used a switch statement. Odd that they didn't think of that :)

                          Check out my blog at http://msdev.pro/

                          1 Reply Last reply
                          0
                          • K Kent Sharkey

                            GitHub - samuelmarina/is-even[^]

                            Quote:

                            This is a 100% serious project, and it is made to help the community.

                            A brief excerpt:

                            function isEven(number) {
                            if(number === 1) return false;
                            else if(number === 2) return true;
                            else if(number === 3) return false;
                            else if(number === 4) return true;
                            else if(number === 5) return false;
                            else if(number === 6) return true;
                            else if(number === 7) return false;

                            They're up to 1,000,001 now. Help them grow! :doh:

                            TTFN - Kent

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #63

                            I feel the power of Javascript infusing me! :laugh:

                            A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                            1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              Only works with base-10 ? :-D Surely it would be better written recursively.

                              D Offline
                              D Offline
                              Dan Neely
                              wrote on last edited by
                              #64

                              PIEBALDconsult wrote:

                              Only works with base-10 ?

                              You just need to add conversion functions and call them first.

                              function hexToDec(number) {
                              if (number === 1) return 1;
                              else if (number === 2) return 2;
                              //...
                              else if (number === A) return 10;
                              else if (number === B) return 11;
                              //...
                              }

                              Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups