re: keyCode

Hi,

In the expression of keyCode it says:.

[...] "When checking for these keys, it can be useful to first check if the key is coded. This is done with the conditional if (key == CODED), as shown in the example above" [...]

I don't understand why it might be useful to check if the key is coded. Can anybody help me understand?

Cheers,

Tagged:

Answers

  • edited May 2018
    • That was the 1st question I've asked in this forum (the previous 1 actually). 8-|
    • Well, no 1 had answered moi even today! :o3
    • Nonetheless it was very clear to me that checking out for CODED is 100% superstition BS! >:)
    • Although it can be used as a somewhat optimization tech (prematurely exiting the function) if we happen to have a long list of keys to check out, and all of those keys we're interested in are either CODED or not. :-\"
    • Therefore, within the statement: "it can be useful to first check if the key is CODED.", that "can" verb should be replaced w/ a "might", or then that phrase should be completely erased! :>
    • Actually, if we don't care whether a key is lower or upper cased, we can instead simply use keyCode only. *-:)
    • W/ keyCode, we just need to check a key's uppercase form, and we catch both cases! \m/
  • Although it can be used as a somewhat optimization tech (prematurely exiting the function) if we happen to have a long list of keys to check out, and all of those keys we're interested in are either CODED or not.

    We can also distinguish between coded and not coded with a if clause CODED and then analyze coded and not coded separately which is also a optimization

Sign In or Register to comment.