Yup. All the samples are written that way. You can also combine the two ideas by (for example) making Enter toggle Scroll Lock. Personally I like Scroll Lock for this purpose because it gives you a light on the keyboard telling you whether hotkeys are on or off.