Today, I stepped back into code land. With my layout complete from my last session, I started on methods so the buttons would actually do something when clicked. Note: in the button’s description, you must add the “onClick” part, otherwise it is an inactive button. I needed to have the program to have the id of the button to perform the button-specific task. So, I call it.
The concept of the try block is fabulous. Say there’s an input that does not compute, like divide by zero or letters or whathaveyou. Without the try block, the program crashes. The try block “catches” exceptions like that and essentially says “chill, we just won’t do this one.” I like computers. They are really dogged. They will try to the point of crashing. But, that trait really isn’t desirable when life hands you so many exceptions. So, the try block will be that code that I imagine will come up a lot. Thanks, try block.
Today, I used my first “or” statement in programming. It was: io_value == “0”||io_value == “-0.” I’ve never used pipes for anything and now I get to use the “double pipe.” More fun operators here. My favorite part about this is the symmetry of that equation. I’ve forgotten the elegance of mathematics. This time was hooking up the number pad and the tricky plus or minus button. Next session will be quite tricky, actual functions.