Better message

This commit is contained in:
Yann Esposito 2009-09-11 11:59:18 +02:00
parent edcd362362
commit 29fc2e0457

View file

@ -6,6 +6,9 @@ class TodoList
def initialize() def initialize()
@todoList=[] @todoList=[]
end end
def empty?
@todoList.empty?
end
def addTask(task) def addTask(task)
@todoList << task @todoList << task
end end
@ -65,7 +68,11 @@ if __FILE__ == $0:
puts todoList[Integer($1)].to_s puts todoList[Integer($1)].to_s
when /^(l|list)( ?(\d*))?/ when /^(l|list)( ?(\d*))?/
if $3.length>0: print "number "+$3 end if $3.length>0: print "number "+$3 end
print todoList.to_s if todoList.empty?
print "Nothing to do!\n"
else
print todoList.to_s
end
when /^(s|save)( (.*))?/ when /^(s|save)( (.*))?/
if $3 and $3.length>0: if $3 and $3.length>0:
filename=$3 filename=$3