FIND YOUR NEXT FEW LINES

Results for “if”

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

946 snippets foundClear filters
C++Sequence algorithms

Calculate changes between successive readings

C++: adjacent_difference keeps the first value and then writes each difference from its predecessor.

C++✓ Tested
SQLiteDates & time

Calculate whole days between dates

Subtract Julian day values for date-only inputs.

julianday✓ Tested
ReactEffects & lifecycle

Cancel an asynchronous operation on unmount

Cancel an asynchronous operation on unmount with a small React component and explicit browser behavior.

React✓ Tested
GitGetting Started

Check a change for whitespace problems

Git: Check a change for whitespace problems inside the disposable repository created by the input setup.

Git✓ Tested
Bash ScriptsArguments & decisions

Choose among several numeric ranges

Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.

Bash Scripts✓ Tested
PythonGetting Started

Choose between two branches

Python: Use if and else to handle an available or empty stock count.

Python✓ Tested
C#Getting Started

Choose between two branches

C#: Use if and else to handle an available or empty stock count.

C#✓ Tested
JavaGetting Started

Choose between two branches

Java: Use if and else to handle an available or empty stock count.

Java✓ Tested
JavaScriptGetting Started

Choose between two branches

JavaScript: Use if and else to handle an available or empty stock count.

JavaScript✓ Tested
TypeScriptGetting Started

Choose between two branches

TypeScript: Use if and else to handle an available or empty stock count.

TypeScript✓ Tested
C++Getting Started

Choose between two branches

C++: Use if and else to handle an available or empty stock count.

C++✓ Tested
CGetting Started

Choose between two branches

C: Use if and else to handle an available or empty stock count.

C✓ Tested