krystal: プログラミング超初心者(文系)

2009-01-08 (Thu)たのしいRuby練習問題

P - 306 練習問題(3)


  • Unixのduコマンドのように、再帰的に掘り下げて調べ表示するメソッドduを定義してみよう。
def du(path)
  size = FileTest.size(path)
  if FileTest.directory?(path)
        next if name == "."
        next if name == ".."
        size += du(File.join(path, name))
  printf("%8d %s\n", size, path)
  return size  #size(数字)を返さないと、↑のduはprintfを返すことになるからnil。だから、size+nilは怒られる

KaedonKaedon 2016/05/07 15:52 Hi Gina!I have a question not related to this post…I went back to read some of your early pregancy posts and you were saying that you ate a lot of pineapple because it would help with implantation (and I guess it did ). However now I’m also reading that you sh#7udn&o821l;t eat pineapple because it might stimulate labor. Have you ever heard of this? I still have one waiting for me at home and now I’m not sure if it’s good to eat it or bad to eat it!

CaidenCaiden 2016/05/08 22:32 Ce taranca esti in pozele alea Florica! Hi, hi, hi!Auzi, dar dupa <a href="http://omrxjg.com">prtoizopia</a> "Sa facem loc pentru porc" de ce apare o poza cu nasu tau de cununie, fostul tau sef, Adrian? :)

ConyersConyers 2016/05/09 10:37 Thanks for your response and for reading the site. You are correct, we just see the numbers not every game. Decision making is something he needs to improve upon going forward. <a href="http://fdsaci.com">Boaeeendhd</a> mistakes need to stop. I’m posting another story today about this and giving you credit for bringing this to my attention. His defense was a bigger issue than his batting last year and we need to keep that part of his game in mind.


トラックバック - http://rubyist.g.hatena.ne.jp/krystal/20090108