From 29fc2e0457aa38096ffb6bd469bf29fd768f5a71 Mon Sep 17 00:00:00 2001 From: Yann Esposito Date: Fri, 11 Sep 2009 11:59:18 +0200 Subject: [PATCH] Better message --- todolist.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/todolist.rb b/todolist.rb index 5763532..d2c7ecc 100644 --- a/todolist.rb +++ b/todolist.rb @@ -6,6 +6,9 @@ class TodoList def initialize() @todoList=[] end + def empty? + @todoList.empty? + end def addTask(task) @todoList << task end @@ -65,7 +68,11 @@ if __FILE__ == $0: puts todoList[Integer($1)].to_s when /^(l|list)( ?(\d*))?/ 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)( (.*))?/ if $3 and $3.length>0: filename=$3