FIND YOUR NEXT FEW LINES

Results for “Functions & data types”

Small, practical examples. Search by task or narrow things down below.

787 snippets foundClear filters
PythonFunctions & error handling

Handle an expected child-process failure

Python: Catch CalledProcessError when check=True reports a nonzero exit status.

Python✓ Tested
PythonStructured data & serialization

Handle malformed JSON input

Python: Catch JSONDecodeError without hiding unrelated programming errors.

Python✓ Tested
TypeScriptGetting Started

Handle three possible outcomes

TypeScript: Check high, normal and low values with an ordered conditional chain.

TypeScript✓ Tested
SQLRelationships & missing data

Include zero counts for missing relationships

SQL: Count the non-null child key after a left join so a missing relationship produces zero.

SQL✓ Tested
SQL ServerRelationships & missing data

Include zero counts for missing relationships

SQL Server: Count the non-null child key after a left join so a missing relationship produces zero.

SQL Server✓ Tested
PostgresRelationships & missing data

Include zero counts for missing relationships

Postgres: Count the non-null child key after a left join so a missing relationship produces zero.

Postgres✓ Tested
SQLiteRelationships & missing data

Include zero counts for missing relationships

SQLite: Count the non-null child key after a left join so a missing relationship produces zero.

SQLite✓ Tested
Docker / ComposeNetworks & volume metadata

Inspect a user-defined network’s driver

Docker / Compose: The default driver for a local user-defined network is bridge.

Docker / Compose✓ Tested
GoGetting Started

Inspect a value’s type

Inspect a value’s type using a complete Go program with explicit sample inputs.

Go✓ Tested
TypeScriptPromises & iteration protocols

Inspect both successful and failed promise results

TypeScript: allSettled preserves input order and reports failures without rejecting the combined promise.

TypeScript✓ Tested
TypeScriptRegular expressions & URL encoding

Inspect the parsed pieces of a URL

TypeScript: Use URL properties rather than splitting a URL at punctuation.

TypeScript✓ Tested
TypeScriptArray traversal & selection

Iterate with array indices and values

TypeScript: entries provides each position and value without a separate counter.

TypeScript✓ Tested