• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Ruby [Ruby] Funcion savefile()

Status
Not open for further replies.

Doddy

Leech
User
Joined
Apr 1, 2012
Messages
169
Reputation
0
Reaction score
406
Points
63
Credits
0
‎13 Years of Service‎
57%
Una simple funcion en ruby para escribir en un archivo de texto.

Code:
>
#!usr/bin/ruby
#Funcion savefile()
#Coded By Doddy H

def savefile(file,text)
 save = File.open(file, "a")
 save.puts text+"\n"
 save.close
end

savefile("test.txt","probando")

#The End ?
 
Status
Not open for further replies.
Back
Top