variable with extension

I ned to create a file of the name of a variable?
but i can’t create an extension., ‘w’ ) {|file| file.write( ‘testfile’ )}

how can i maka a extension like this, ‘w’ ) {|file| file.write( ‘testfile’ )}

What you want to do is: + ‘.txt’, ‘w’ ) {|file| file << ‘content’ }

Above the “file << ‘content’” makes sure that the file pointer is
closed after the content is written instead of leaving it open as in
your example “file.write( ‘testfile’ )”.

Thiago J.

On May 17, 6:38 am, GA Gorter [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs