Gallery
Kuovonne's Guide to Scripting in Airtable
Share
Explore
Developing Generic Coding Skills

Using Variables

Your donations tell Kuovonne that you value her content and want her to continue publishing.

Variable Names

Name functions with a verb and things with a noun
Use variable names that reflect the actual object (e.g. a variable named “records” should be an array of records, not a query result object)
Use singular names for variables that hold a single value, and plural names for variables that can hold multiple values
Limit abbreviations
Be both as specific as possible and generic as possible for the situation.

Variable Name Case

Use the case that is standard for your language.
lowerCamelCase (also known as simply camelCase)
PascalCase (also known as UpperCamelCase)
snake_case
kebab-case
SCREAMING_SNAKE_CASE (often used for constants)

Data Type

Limit each variable to a specific data type. Changing the data type of a variable can lead to confusion and errors. (The main exception is setting a variable to null.)
Some data type choices are clear—a number or a text string. However, some choices are more complex. Should you use an array or an object? If you use an object, what should the keys be?

Variable Scope

The scope of a variable determines which sections of code can use that variable.
Know the scope of your variables and why you chose a particular scope.
Use global variables carefully, mostly for constants.
Know when you are using a local variable versus a similarly named variable inherited from a parent scope.
Define hardcoded values in variables upfront. If the hardcoded value changes, you can change it in one place.
The content in this guide is free, but creating it takes time and money. If you like this content, .

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.