Sunday, February 9, 2014

Week 4

This week, we learned something about recursion and raising exceptions. I found recursion so amazing that it could finish many surprising things. For example, in the lecture, our professor showed us how to use recursion to draw a beautiful picture. I was totally amazed by the beauty of recursion -- it could repeat what it does for several times and make a snowflake-like things. However, because I just started to learn recursion, I sometimes found it a little difficult to understand. I also reviewed how to raise errors and exceptions and learned some new stuff like try. Try clause is pretty useful since it can raise the error without stopping the program. Another thing that's new is the function object. Now I have a better understanding of what function object is. It is not the result of a function, but just an object. It can be called just by typing its name.  

2 comments:

  1. I like how you think recursion is beautiful. But what are you referring to with the phrase 'snowflake-like things'? Are you referring to the chain of recursive function calls towards the base case?

    ReplyDelete
    Replies
    1. That's what we did in the lecture. The professor showed us how to create a beautiful picture using recursion.

      Delete