Questions tagged [ruby]

This challenge is related to the Ruby language. Note that challenges that require the answers to be in a specific language are generally discouraged.

Filter by
Sorted by
Tagged with
62
votes
50answers
18k views

Tips for golfing in Ruby

What general tips can you give for golfing in Ruby? I'm looking for ideas that can be applied to code golf problems in general that are specific to Ruby. (For example, "Remove comments" would not be ...
5
votes
2answers
306 views

Golf my iteration function

Here is my ungolfed Ruby code for a function I want to try and golf: ...
-12
votes
16answers
342 views

Sequence and Series

Use any programming language to display numbers divisible by 1000000 that are greater than 1 and less than 10000000. Each number should be displayed in new line. Your program should display exactly: <...
7
votes
2answers
157 views

How to improve Ruby code under some restrictions

I'm (still) trying to make another submission to the Largest Number Printable question, and I've got the following bit of code: ...
13
votes
3answers
871 views

Advice for ruby

How can I shorten: p=gets.to_i a=gets b=gets.to_i If my input is an integer, followed by a string, followed by an integer?
18
votes
11answers
1k views

Crash IRB (interactive Ruby)

Ruby comes with a built-in REPL, which is quite handy. Your challenge is to crash it in the least amount of code! The definition of "crash" is "make it exit in an unintended way." This means ...