• 0 Posts
  • 35 Comments
Joined 1 year ago
cake
Cake day: July 31st, 2023

help-circle








  • paholg@lemm.eetoProgrammer Humor@programming.devExam Answer
    link
    fedilink
    English
    arrow-up
    21
    ·
    6 months ago

    Works even better in Ruby, as the code as given is valid, you just need to monkey patch length:

    #!/usr/bin/env ruby
    
    module DayLength
      def length
        if ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].include? self
          "24 hours"
        else
          super
        end
      end
    end
    
    class String
      prepend DayLength
    end
    
    day = "Monday"
    
    x = day.length
    
    print(x)
    

  • paholg@lemm.eetoProgrammer Humor@programming.devExam Answer
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    6 months ago

    It could be Ruby; puts is more common, but there is a print. With some silly context, the answer could even be correct:

    #!/usr/bin/env ruby
    
    module DayLength
      def length
        if ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].include? self
          "24 hours"
        else
          super
        end
      end
    end
    
    class String
      prepend DayLength
    end
    
    day = "Monday"
    
    x = day.length
    
    print(x)
    










  • paholg@lemm.eetoGames@sh.itjust.worksSteam keeps on winning
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 months ago

    I agree. I would love to have an alternative, but there just isn’t one, and I don’t think it’s Valve’s fault.

    Valve also hasn’t really done what other monopolistic companies have done, which is use their advantages to expand into other areas and crush the smaller players there.