FIND YOUR NEXT FEW LINES

Results for “if”

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

946 snippets foundClear filters
RustFunctions & data types

Accept different types with a generic function

Accept different types with a generic function in a complete Rust program using the standard library.

Rust✓ Tested
C#Collections & data structures

Add a dictionary entry only if absent

C#: TryAdd reports a duplicate key without replacing its existing value.

C#✓ Tested
jQueryHTTP requests

Attach an application-specific request header

jQuery: The headers option adds a header to this request only.

jQuery✓ Tested
AngularLists & control flow

Bind a narrowed value using an @if alias

Bind a narrowed value using an @if alias with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
RustTesting & reusable patterns

Borrow text until a modification is needed

Borrow text until a modification is needed in a complete Rust program using the standard library.

Rust✓ Tested
JavaScriptArray restructuring

Calculate differences between adjacent readings

JavaScript: Slice off the first value and compare each remaining value with its predecessor.

JavaScript✓ Tested
TypeScriptArray restructuring

Calculate differences between adjacent readings

TypeScript: Slice off the first value and compare each remaining value with its predecessor.

TypeScript✓ Tested
GoGetting Started

Choose a branch with if and else

Choose a branch with if and else using a complete Go program with explicit sample inputs.

Go✓ Tested
HTMLImages & embedded documents

Choose a different image for a small viewport

HTML: Picture evaluates source media conditions before falling back to the img source.

HTML✓ Tested
Bash ScriptsArguments & decisions

Classify a filename with shell patterns

Bash Scripts: Case patterns support alternatives without launching an external regex tool.

Bash Scripts✓ Tested
C#Dates & precise numbers

Convert a timestamp to a different fixed offset

C#: ToOffset changes the displayed local time while retaining the same instant.

C#✓ Tested
Docker / ComposeDockerfile patterns

Copy an artifact from an earlier build stage

Docker / Compose: A named stage can produce an artifact without copying its other files.

Docker / Compose✓ Tested