FIND YOUR NEXT FEW LINES

Results for “if”

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

946 snippets foundClear filters
CBinary formats & structured parsing

Validate a simple C-style ASCII identifier

C: Check the first character separately from subsequent characters and reject empty input.

C✓ Tested
HTMLInput constraints

Validate a structured text identifier

HTML: The pattern attribute matches the entire nonempty input; required handles the empty case.

HTML✓ Tested
JavaScriptRegular expressions & URL encoding

Validate a whole ASCII identifier

JavaScript: Use an anchored expression without the multiline flag and reject a trailing line break explicitly.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Validate a whole ASCII identifier

TypeScript: Use an anchored expression without the multiline flag and reject a trailing line break explicitly.

TypeScript✓ Tested
PythonText validation & encoding

Validate an entire identifier

Python: Use fullmatch so a regex must consume the complete input.

Python✓ Tested
Linux CommandsArchive integrity & packaging

Verify a file against a checksum manifest

Linux Commands: Use sha256sum -c with a manifest obtained from a trusted source.

Linux Commands✓ Tested
Docker / ComposeNetworks & volume metadata

Verify a read-only volume rejects writes

Docker / Compose: A failed write confirms the mount’s read-only behavior.

Docker / Compose✓ Tested
Docker / ComposeContainer lifecycle

Verify that a one-off container was removed

Docker / Compose: An automatically removed container no longer appears in an exact-name listing.

Docker / Compose✓ Tested
SQLiteDates & time

Add days to a date

Use a date modifier for calendar arithmetic.

date✓ Tested
HTMLImages & embedded documents

Allow embedded scripts without granting same-origin access

HTML: Grant only allow-scripts so the sandboxed document retains an opaque origin.

HTML✓ Tested
HTMLImages & embedded documents

Block scripts in an embedded document

HTML: An empty sandbox attribute applies the default set of restrictions, including blocking script execution.

HTML✓ Tested
Arduino / CGetting Started

Branch on a threshold

Arduino / C: Branch on a threshold on an Uno with the Serial Monitor set to 9600 baud.

Arduino / C✓ Tested