Last active
December 28, 2015 15:39
-
-
Save natanio/7522848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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.