Results for “number”
Small, practical examples. Search by task or narrow things down below.
Repeat a fixed number of times
C: Use a counted loop to print three numbered steps.
C✓ Tested
Repeat a string a fixed number of times
JavaScript: String.repeat requires a nonnegative finite repetition count.
JavaScript✓ Tested
Repeat a string a fixed number of times
TypeScript: String.repeat requires a nonnegative finite repetition count.
TypeScript✓ Tested
Repeat an action a fixed number of times
Use a counter and delay for a simple finite sequence.
for loop✓ Tested
Repeat text a fixed number of times
Java: Use String.repeat with a nonnegative repetition count.
Java✓ Tested
Restart numbering at an individual list item
HTML: A value on one ordered-list item sets its ordinal and affects following items.
HTML✓ Tested
Show line numbers beside matches
Linux Commands: Use grep -n so a result identifies its position in the source file.
Linux Commands✓ Tested
Sort a sequence of numbers
PowerShell: Sort a sequence of numbers using PowerShell 7.
PowerShell✓ Tested
Sort numbers numerically
Supply a numeric comparator instead of JavaScript string sorting.
JavaScript✓ Tested
Take a limited number of iterator values
Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.
Python✓ Tested
Test whether a number is even
Test whether a number is even using a complete Go program with explicit sample inputs.
Go✓ Tested
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested