this post was submitted on 24 Mar 2024
771 points (98.6% liked)

Programmer Humor

18961 readers
352 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 5 months ago* (last edited 5 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)