FIND YOUR NEXT FEW LINES

Results for “cr”

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

1833 snippets foundClear filters
JavaScriptArray traversal & selection

Read the final array item with a negative index

JavaScript: at supports negative positions counted from the end.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Read the final array item with a negative index

TypeScript: at supports negative positions counted from the end.

TypeScript✓ Tested
Bash ScriptsGetting Started

Read the first array element

Bash Scripts: Read the first array element with a small standalone Bash program.

Bash Scripts✓ Tested
JavaScriptGetting Started

Read the first collection element

JavaScript: Access index zero only after establishing that the collection is nonempty.

JavaScript✓ Tested
TypeScriptGetting Started

Read the first collection element

TypeScript: Access index zero only after establishing that the collection is nonempty.

TypeScript✓ Tested
Bash ScriptsGetting Started

Read the length of an ASCII string

Bash Scripts: Read the length of an ASCII string with a small standalone Bash program.

Bash Scripts✓ Tested
JavaScriptPromises & iteration protocols

Recover from an expected promise rejection

JavaScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

JavaScript✓ Tested
TypeScriptPromises & iteration protocols

Recover from an expected promise rejection

TypeScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

TypeScript✓ Tested
Bash ScriptsInput streams & redirection

Redirect an entire group of commands

Bash Scripts: Brace grouping runs in the current shell and shares a single output redirection.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Refuse to overwrite an existing file with redirection

Bash Scripts: Noclobber makes a plain greater-than redirection fail when the target already exists.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Reject a missing required configuration value

Bash Scripts: Check a required value explicitly and emit a controlled diagnostic before exiting.

Bash Scripts✓ Tested
Bash ScriptsParameter expansion

Remove a known prefix with a shell pattern

Bash Scripts: The hash expansion removes the shortest matching prefix without changing the original variable.

Bash Scripts✓ Tested