11)
(a)
(a) assigns
Imp
Eqv
Why do we need
If two logical expressions are always equal no matter what the values of their variables are, then they are logically identical. Such a relationship is called an "identity". These are clearly identities:
No matter what Boolean values X and Y are, Z will always be True. The trick here though is the operator precedence. Just like 1 + 2 * 3 is 7, not 9, these guys all have precedence. To show the precedence with brackets, the expressions I actually asked about are equivalent to
It is much less clear now that the last three are identities. The moral of the story is to be very careful with operator precedence when using logical operators -- equals binds tighter than Or!
12) Consider this program:
s = "Eric read Æsop's Fables"arr = Split(s, "e", -1, 1)
arr is an array with how many elements?
(a) 2(b) 3(c) 4(d) 5
It's (c). The parts are "", "ric r", "ad Æsop's Fabl", "s"
The 1 means "go case insensitive". I agonized over whether or not
That finds the "e" inside the ligature, so why shouldn't Split split on the ligature? Basically, we just decided that it was too weird to split a string in the middle of a ligature. I was never very happy with this decision, and if I had to do it again, I probably would decide the other way. But it's too late now!
Wow, that took longer than I expected. Coming up next, a short break from scripting.