Rules for naming a variableA variable name can only have letters (both uppercase and lowercase letters), digits and underscore. The first letter of a variable should be either a letter or an underscore. There is no rule on how long a variable name (identifier) can be.
Variable names are shown in green color in the questionnaire Designer. The following are examples of valid variable names: age, gender, x25, age_of_hh_head. The following are examples of invalid variable names: age_ (ends with an underscore);
Most surveys use one of three methods for naming variables: cryptic codes, question numbers (e.g. “1”, “2”, “3” or “A1”, “A2a”, “A2b”) or descriptive names (e.g., “gender”, “age”, “employment”).
function startEditing(){ if (user.canEdit(currentDocument)){ editorControl.setEditMode(true); setButtonDown(btnStartEditing); } }
Should read like a narrative work.
One rule I always follow is this: if a variable encodes a value that is in some particular units, then those units have to be part of the variable name. Example:
int postalCodeDistanceMiles; decimal reactorCoreTemperatureKelvin; decimal altitudeMsl; int userExperienceWongBakerPainScale
I will NOT be responsible for crashing any Mars landers (or the equivalent failure in my boring CRUD business applications).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With