Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

A Ruby write to file example

# open and write to a file with ruby
open('myfile.out', 'w') do |f|
  f.puts "Hello, world."
end

# an alternative approach:
open('myfile.out', 'w') do |f|
  f << "Hello, world.
"
end
 
PREVIOUS NEXT
Tagged: #A #Ruby #write #file
ADD COMMENT
Topic
Name
4+2 =