FIND YOUR NEXT FEW LINES

Results for “Functions & parameter validation”

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

202 snippets foundClear filters
GoFunctions & types

Define related integer constants

Define related integer constants using a complete Go program with explicit sample inputs.

Go✓ Tested
RustFunctions & data types

Derive comparison and debugging behavior

Derive comparison and debugging behavior in a complete Rust program using the standard library.

Rust✓ Tested
JavaScriptNumbers & numeric validation

Detect NaN without converting the input

JavaScript: Number.isNaN tests the special numeric value instead of applying string-to-number conversion.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Detect NaN without converting the input

TypeScript: Number.isNaN tests the special numeric value instead of applying string-to-number conversion.

TypeScript✓ Tested
JavaScriptNumbers & numeric validation

Display a number with a fixed decimal width

JavaScript: toFixed returns a formatted string rather than a numeric value.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Display a number with a fixed decimal width

TypeScript: toFixed returns a formatted string rather than a numeric value.

TypeScript✓ Tested
Bash ScriptsParameter expansion

Distinguish unset variables from empty strings

Bash Scripts: Omitting the colon tests only whether a variable is unset; including it also treats an empty value as missing.

Bash Scripts✓ Tested
JavaScriptNumbers & numeric validation

Drop the fractional part toward zero

JavaScript: Math.trunc differs from floor for negative inputs.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Drop the fractional part toward zero

TypeScript: Math.trunc differs from floor for negative inputs.

TypeScript✓ Tested
GoFunctions & types

Embed a struct for shared fields

Embed a struct for shared fields using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonText validation & encoding

Encode and decode binary data as Base64

Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.

Python✓ Tested
C#Text validation & encoding

Enumerate Unicode code points

C#: EnumerateRunes combines surrogate pairs into Unicode scalar values.

C#✓ Tested