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. The Lounge
  3. Fun with Ruby

Fun with Ruby

Scheduled Pinned Locked Moved The Lounge
rubylearning
6 Posts 5 Posters 0 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.
  • I Offline
    I Offline
    Indivara
    wrote on last edited by
    #1

    I'm debugging a ruby program, while learning the language at the same time. First impressions - :wtf: :omg: :doh: Here are a few WTFs * Whitespace alters behavior a + b adds a to b (variables) a +b calls method a * Reserved words can be used as method names * Methods can be eclipsed by variables with the same name

    def foo
    puts "I am a method"
    end

    followed by

    foo=42
    puts foo

    will output 42 * Methods return the value of the last statement by default I'm sure there are many more. You folks who have to deal with this every day have my deepest condolences.

    M 5 2 Replies Last reply
    0
    • I Indivara

      I'm debugging a ruby program, while learning the language at the same time. First impressions - :wtf: :omg: :doh: Here are a few WTFs * Whitespace alters behavior a + b adds a to b (variables) a +b calls method a * Reserved words can be used as method names * Methods can be eclipsed by variables with the same name

      def foo
      puts "I am a method"
      end

      followed by

      foo=42
      puts foo

      will output 42 * Methods return the value of the last statement by default I'm sure there are many more. You folks who have to deal with this every day have my deepest condolences.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      I remember back in the early 90s I was using a product called SuperBase, I debugged to a line of code and was getting a really weird error, there was nothing wrong with the code, it was really simple but it was throwing an error on that line. I tried everything I could think of and eventually deleted the line and retyped it. Never saw the error again. Really weird...

      Never underestimate the power of human stupidity RAH

      I 1 Reply Last reply
      0
      • I Indivara

        I'm debugging a ruby program, while learning the language at the same time. First impressions - :wtf: :omg: :doh: Here are a few WTFs * Whitespace alters behavior a + b adds a to b (variables) a +b calls method a * Reserved words can be used as method names * Methods can be eclipsed by variables with the same name

        def foo
        puts "I am a method"
        end

        followed by

        foo=42
        puts foo

        will output 42 * Methods return the value of the last statement by default I'm sure there are many more. You folks who have to deal with this every day have my deepest condolences.

        5 Offline
        5 Offline
        5imone
        wrote on last edited by
        #3

        Reading the title I thought: Oh no! Silvio(*) has joined CP, may be I should leave ... *For Italians it is easier to understand

        L P 2 Replies Last reply
        0
        • 5 5imone

          Reading the title I thought: Oh no! Silvio(*) has joined CP, may be I should leave ... *For Italians it is easier to understand

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

          5imone wrote:

          For Italians it is easier to understand

          Oh, all of us Europeans know Silvio; he is the man we all aspire to be. ;)

          1 Reply Last reply
          0
          • M Mycroft Holmes

            I remember back in the early 90s I was using a product called SuperBase, I debugged to a line of code and was getting a really weird error, there was nothing wrong with the code, it was really simple but it was throwing an error on that line. I tried everything I could think of and eventually deleted the line and retyped it. Never saw the error again. Really weird...

            Never underestimate the power of human stupidity RAH

            I Offline
            I Offline
            Indivara
            wrote on last edited by
            #5

            For me, sometimes MS Word does the red squiggly line thing showing a spelling mistake, even when the word is clearly correct. Deleting and rewriting it exactly the same causes the squiggle to go away.

            1 Reply Last reply
            0
            • 5 5imone

              Reading the title I thought: Oh no! Silvio(*) has joined CP, may be I should leave ... *For Italians it is easier to understand

              P Offline
              P Offline
              peterkmx
              wrote on last edited by
              #6

              Ha ha this is a good one ... upvoted. Cheers

              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