RosettaCodeData/Task/Take-notes-on-the-command-line/Sidef/take-notes-on-the-command-line.sidef

11 lines
202 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
var file = %f'notes.txt'
2016-12-05 23:44:36 +01:00
if (ARGV.len > 0) {
2017-09-23 10:01:46 +02:00
var fh = file.open_a
fh.say(Time.local.ctime + "\n\t" + ARGV.join(" "))
fh.close
2016-12-05 23:44:36 +01:00
} else {
2017-09-23 10:01:46 +02:00
var fh = file.open_r
fh && fh.each { .say }
2016-12-05 23:44:36 +01:00
}