Results for “return”
Small, practical examples. Search by task or narrow things down below.
Check whether every item matches
TypeScript: every stops at the first failed predicate and returns true for an empty array.
TypeScript✓ Tested
Check whether text is valid JSON
Reject malformed input before processing it.
json_valid✓ Tested
Clamp a number to inclusive bounds
C#: Math.Clamp returns the nearest endpoint when the value lies outside the range.
C#✓ Tested
Collect matching ancestors
jQuery: parents can return several ancestors, ordered from the nearest outward.
jQuery✓ Tested
Combine matching rows with INNER JOIN
Read product names with their matching stock values.
INNER JOIN✓ Tested
Combine two selections
jQuery: add returns a combined collection in document order.
jQuery✓ Tested
Compare a command case-sensitively
Arduino / C: strcmp returns zero when both null-terminated strings match.
Arduino / C✓ Tested
Compare two C strings for equality
C: strcmp returns zero only when both null-terminated byte strings are equal.
C✓ Tested
Compare with a calculated value
Find products above the average price.
subquery✓ Tested
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Copy a range without changing the source
JavaScript: Array.slice returns a shallow copy of the selected half-open range.
JavaScript✓ Tested
Copy a range without changing the source
TypeScript: Array.slice returns a shallow copy of the selected half-open range.
TypeScript✓ Tested