Jump to content

Take notes on the command line: Difference between revisions

(→‎{{header|Scala}}: Scala added)
Line 1,363:
File.open(notes, 'a') {|file| file.puts "%s\n\t%s" % [Time.now, ARGV.join(' ')]}
end</lang>
{{header|Scala}}
[[Category:Scala Implementations]]
{{libheader|Scala}}
<lang scala>import java.io.{ FileNotFoundException, FileOutputStream, PrintStream }
import java.util.Date
 
object TakeNotes extends App {
val notesFileName = "notes.txt"
if (args.length > 0) {
val ps = new PrintStream(new FileOutputStream(notesFileName, true))
ps.println(new Date() + args.mkString("\n\t", " ", "."))
ps.close()
} else try {
io.Source.fromFile(notesFileName).getLines().foreach { line => println(line) }
} catch {
case e: FileNotFoundException => println(e.getLocalizedMessage())
case e: Throwable => {
println("Some other exception type:")
e.printStackTrace()
}
}
}</lang>
=={{header|Scheme}}==
(moved from Racket)
Line 1,386 ⟶ 1,408:
#:mode 'text #:exists 'append)
]))</lang>
 
 
=={{header|Seed7}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.