string = "First prize:\n#{$winners[0]}\nRunners up:"
for i in 1..5
string += "\n" + $winners[i]
end
file = File.new('Winners.txt', 'wb')
file.write(string)
file.close
strings = []
strings.push "First prize:"
strings.push $winners[0]
strings.push "Runners Up:"
for i in 1..5
strings.push $winners[i]
end
file = File.new("Winners.txt", "wb") # <- Important that it has that 'b'
for i in 0...strings.size
file.write string[i]
end
file.close
strings = []
strings.push "First prize:\n"
strings.push $winners[0] + "\n"
strings.push "Runners Up:\n"
for i in 1..5
strings.push $winners[i] + "\n"
end
file = File.new("Winners.txt", "w+")
for i in 0...strings.size
file.write strings[i]
end
file.close
$winners = ['Fred', 'Johnson', 'Peter', 'Julie', 'Pat', 'Steve']
string = "First prize:\n#{$winners[0]}\nRunners up:"
for i in 1..5
string += "\n" + $winners[i]
end
file = File.new('Winners.txt', 'wb')
file.write(string)
file.close
$winners = ['Fred', 'Johnson', 'Peter', 'Julie', 'Pat', 'Steve']
string = "First prize:\n" + $winners[0] + "\nRunners up:"
for i in 1...$winners.size
string += "\n" + $winners[i]
end
file = File.new('Winners.txt', 'w+')
file.write(string)
file.close