Promptles
Automation & Scripting

Idempotent

intermediate

Definition

An operation that produces the same result no matter how many times you run it. Idempotent scripts are safe to re-run: if something fails halfway through, you can run the whole script again without creating duplicates or breaking things.

In the wild

A script that says 'create the users table if it doesn't exist' is idempotent: running it twice won't create two tables or throw an error. A script that says 'insert a row' is not: running it twice creates duplicate rows.

More from Automation & Scripting