Skip to content

Instantly share code, notes, and snippets.

@natanio
Last active December 28, 2015 15:39
Show Gist options
  • Save natanio/7522848 to your computer and use it in GitHub Desktop.
Save natanio/7522848 to your computer and use it in GitHub Desktop.
def mix(syllable1, syllable2)
arr = [syllable1, syllable2]
t = 3
until t == 13 do
t.times do
index = rand(2)
print arr[index] +', '
end
puts
t += 1
end
end
puts "What is syllable 1?"
s1 = gets.chomp
puts "What is syllable 2?"
s2 = gets.chomp
filename = "#{s1} and #{s2} Mix.rb"
target = File.open(filename, 'w')
output = mix(s1,s2)
target.write(output)
puts "Done!"
@natanio
Copy link
Author

natanio commented Nov 19, 2013

@mikekreeki Thanks for the detailed help and solution! I couldn't figure out why it was making a blank file, but now see that I need to save it to a variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment