# HG changeset patch # User Steve Losh # Date 1318220936 14400 # Node ID 1b25f598ff48a6323f363d3be49d6832e51b3200 # Parent 29be75a733f54dfd09d33f522b8ccb5e80aea8ee ints diff -r 29be75a733f5 -r 1b25f598ff48 chapters/22.markdown --- a/chapters/22.markdown Mon Oct 10 00:17:18 2011 -0400 +++ b/chapters/22.markdown Mon Oct 10 00:28:56 2011 -0400 @@ -94,9 +94,9 @@ user has set" comparison operator. Now run the following command: :set ignorecase - :if "foo" ==? "FOO" + :if "foo" ==# "FOO" : echom "one" - :elseif "foo" ==? "foo" + :elseif "foo" ==# "foo" : echom "two" :endif @@ -107,6 +107,16 @@ or insensitive comparisons. Using the normal forms is *wrong* and it *will* break at some point. Save yourself the trouble and type the extra character. +When you're comparing integers this distinction obviously doesn't matter. +Still, I feel that it's better to use the case-sensitive comparisons everywhere, +even where they're not needed, than to forget them in a place that they *are* +needed. + +Using `==#` and `==?` with integers will work just fine, and if you change them +to strings in the future it will work correctly. If you'd rather use `==` for +integers that's fine, but you need to remember to you change the comparison if +you change them to strings in the future. + Exercises ---------