Results for “positive”
Small, practical examples. Search by task or narrow things down below.
Check positive integer addition before performing it
C: Check the upper boundary before adding two known nonnegative integers.
C✓ Tested
Reject a negative quantity with CHECK
SQL: Combine NOT NULL and CHECK because an unknown NULL check result is normally accepted.
SQL✓ Tested
Reject a negative quantity with CHECK
SQL Server: Combine NOT NULL and CHECK because an unknown NULL check result is normally accepted.
SQL Server✓ Tested
Reject a negative quantity with CHECK
Postgres: Combine NOT NULL and CHECK because an unknown NULL check result is normally accepted.
Postgres✓ Tested
Reject a negative quantity with CHECK
SQLite: Combine NOT NULL and CHECK because an unknown NULL check result is normally accepted.
SQLite✓ Tested
Calculate a page count with ceiling division
JavaScript: Use Math.ceil for a nonnegative item count and a positive page size.
JavaScript✓ Tested
Calculate a page count with ceiling division
TypeScript: Use Math.ceil for a nonnegative item count and a positive page size.
TypeScript✓ Tested
Calculate the number of required pages
Python: Use integer arithmetic to round a nonnegative count up to a positive page size.
Python✓ Tested
Extract part of a string
Use one-based positions with substr.
substr✓ Tested
Find the least common multiple with the standard library
C++: std::lcm combines positive integer periods into a common cycle.
C++✓ Tested
Repeat while a condition holds
Python: Count down while a positive number remains, updating the loop variable on each iteration.
Python✓ Tested
Repeat while a condition holds
C#: Count down while a positive number remains, updating the loop variable on each iteration.
C#✓ Tested