function validLetter(n)
{
	if (n <= 0) {
		// If negative number, add it to 26 to count back from "Z" (eg, 26 + -5 = 21)
		// Emulates wheel rotating backwards
		n = 26 + n;
	} else if (n >= 27) {
		// If number greater than 26, subtract 26 to count forward from "A" (eg, 30 - 26 = 4)
		// Emulates wheel rotating forwards
		n = n - 26;
	} else {
		// Or do nothing!
		n = n;
	}

	return n;
}
/* FUNCTION --------------------------------------------------------
	Validate letter numbers (must be betwen 1 and 26)
	Remember, the real Enigma uses wheels/rotors
   ----------------------------------------------------------------- */
FUNCTION
Validate letter numbers (must be betwen 1 and 26)
Remember, the real Enigma uses wheels/rotors
FUNCTION Validate letter numbers ( must be betwen 1 and 26 ) Remember the real Enigma uses wheels / rotors
function validLetter(n)
{
	if (n <= 0) {
		n = 26 + n;
	} else if (n >= 27) {
		n = n - 26;
	} else {
		n = n;
	}
	return n;
}
function validLetter ( n ) { if ( n <= 0 ) { n = 26 + n ; } else if ( n >= 27 ) { n = n - 26 ; } else { n = n ; } return n ; }
FUNCTION
Validate letter numbers (must be betwen 1 and 26)
Remember, the real Enigma uses wheels/rotors
FUNCTION Validate letter numbers ( must be betwen 1 and 26 ) Remember the real Enigma uses wheels / rotors
// If negative number, add it to 26 to count back from "Z" (eg, 26 + -5 = 21) // Emulates wheel rotating backwards // If number greater than 26, subtract 26 to count forward from "A" (eg, 30 - 26 = 4) // Emulates wheel rotating forwards // Or do nothing!