Ruby program to create an empty file

bookmark


# Create a text file.
fobj = File.new("MyFile.txt", "w"); 

# Close file object
fobj.close();  

puts "File created successfully";

 


Output:

File created successfully
Explanation: