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. new bool()

new bool()

Scheduled Pinned Locked Moved The Weird and The Wonderful
pythoncomlearning
26 Posts 15 Posters 3 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.
  • M Marc Clifton

    bool isOffset = new bool();
    if (reader["foo"].ToString().ToUpper().Trim() == "BAR")
    isOffset = true;
    else
    isOffset = false;

    I'll stop now. Marc

    V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #21

    Do you have a keyboard? Hit CTRL+A/Del and save us!

    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

    1 Reply Last reply
    0
    • M Marc Clifton

      bool isOffset = new bool();
      if (reader["foo"].ToString().ToUpper().Trim() == "BAR")
      isOffset = true;
      else
      isOffset = false;

      I'll stop now. Marc

      V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #22

      bool IsOffSet = new bool { improved };

      New version: WinHeist Version 2.2.2 Beta
      I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        So you want

        if (...)
        ...
        else
        ...
        maybe
        ...

        :laugh:

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

        Reminds me of the fuzzy logic that was so popular in the beginning of the nineties.

        Wrong is evil and must be defeated. - Jeff Ello

        1 Reply Last reply
        0
        • M Marc Clifton

          Well, the whole thing could be reduced to

          bool isOffset = reader["foo"].ToString().ToUpper().Trim() == "BAR";

          Why couldn't the programmer see that? Why didn't someone in the 2+ years that this code has been in production fix it? Marc

          V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          J Offline
          J Offline
          Johnny YYZ
          wrote on last edited by
          #24

          Marc Clifton wrote:

          Well, the whole thing could be reduced to

          I guess it can if reader["foo"] can never return null.

          J 1 Reply Last reply
          0
          • J Johnny YYZ

            Marc Clifton wrote:

            Well, the whole thing could be reduced to

            I guess it can if reader["foo"] can never return null.

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #25

            So, just for my own understanding then, something like this would be better then correct? ...

            bool isOffset = (reader["foo"]?.ToString().ToUpper().Trim() == "BAR") ?? false;

            Jeremy Falcon

            1 Reply Last reply
            0
            • M Marc Clifton

              Well, the whole thing could be reduced to

              bool isOffset = reader["foo"].ToString().ToUpper().Trim() == "BAR";

              Why couldn't the programmer see that? Why didn't someone in the 2+ years that this code has been in production fix it? Marc

              V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #26

              Marc Clifton wrote:

              Why couldn't the programmer see that? Why didn't someone in the 2+ years that this code has been in production fix it?

              I have always predicted that this type would show up on the scene sooner or later and, by now, have seen them in action often enough. They actually do as they were told and avoided memory management at all cost. That is why they have no understanding what value types and reference types are all about, nor do they have any idea how value types are an illusion created by the compiler to spare us having to wrestle with references and check for null for every variable. To them these things make no sense and appear to be some random and arcane rules which have been inherited from languages of the past. The same goes for logical operators. I have given up on trying to help the kids when they can't get it done. They think that's more of this arcane ancient stuff that nobody needs to know anymore. Letting them figure it out themselves is the only way to convince them otherwise. So be it.

              The language is JavaScript. that of Mordor, which I will not utter here
              This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
              "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

              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