Tuesday, November 2, 2010

We Have a New Case On Our Hands

Yup, a new case for all of us to solve. Today was all about case statements, a better alternative to "if-ladders" (many selection statements). Case statements use the keywords case (obviously), of, and label, and are great if you have many true parts in a selection section. This type of selection statement basically uses lists, instead of having the keyword or separating boolean expressions in an "if-ladder". Plus, case statements are a lot easier to both write and read!

To help us practice our newly-learned concept, we were asked to create an "ATM" program, which lets the user deposit, withdraw, and transfer money to different accounts. We had to guard against negative balances as well. The program looks really cool when it is run!

And so, our Selection unit is coming to a close. On Thursday, we will be beginning our Repetition unit! That should add a whole new twist to our programs!

A special birthday wish to George Boole (1815-11-02 / 1864-12-08), who invented boolean expressions! Without him, our programs would sure be pretty dull. So happy birthday, George Boole!

Tomorrow is TOKTW Day! Aka no sch--- of course I'm devastated! Everyone knows school is the best place in the world... ;)

No comments:

Post a Comment