FIND YOUR NEXT FEW LINES

Results for “if”

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

946 snippets foundClear filters
C++Ownership & optional values

Read a variant only when it holds the expected type

C++: get_if returns a null pointer rather than throwing for another active alternative.

C++✓ Tested
GitTags & repository configuration

Read an annotated tag’s message

Git: for-each-ref can inspect annotation contents without including a commit diff.

Git✓ Tested
PythonDates & time zones

Read an ISO week number

Python: Use isocalendar because ISO week years can differ from calendar years near January.

Python✓ Tested
PythonJSON & CSV

Read CSV rows as dictionaries

Read a CSV file using its header row as dictionary keys, so each column can be accessed by name.

csv✓ Tested
JavaScriptUTC date operations

Read date components in UTC

JavaScript: UTC accessors avoid differences caused by the machine’s local timezone.

JavaScript✓ Tested
TypeScriptUTC date operations

Read date components in UTC

TypeScript: UTC accessors avoid differences caused by the machine’s local timezone.

TypeScript✓ Tested
SQLGetting Started

Read named columns from a table

SQL: Choose the columns needed and request a deterministic row order.

SQL✓ Tested
SQL ServerGetting Started

Read named columns from a table

SQL Server: Choose the columns needed and request a deterministic row order.

SQL Server✓ Tested
PostgresGetting Started

Read named columns from a table

Postgres: Choose the columns needed and request a deterministic row order.

Postgres✓ Tested
SQLiteGetting Started

Read named columns from a table

SQLite: Choose the columns needed and request a deterministic row order.

SQLite✓ Tested
SQLWindow analytics

Read the last value of the complete partition

SQL: Specify an unbounded-following frame so LAST_VALUE does not stop at the current row.

SQL✓ Tested
SQL ServerWindow analytics

Read the last value of the complete partition

SQL Server: Specify an unbounded-following frame so LAST_VALUE does not stop at the current row.

SQL Server✓ Tested