Results for “Go”
Small, practical examples. Search by task or narrow things down below.
Calculate the greatest common divisor
C: Euclid’s algorithm repeatedly replaces a pair with the divisor and remainder.
C✓ Tested
Call a function with a return value
Call a function with a return value using a complete Go program with explicit sample inputs.
Go✓ Tested
Capture state in a closure
Capture state in a closure using a complete Go program with explicit sample inputs.
Go✓ Tested
Check a function with table-driven cases
Check a function with table-driven cases using a complete Go program with explicit sample inputs.
Go✓ Tested
Check whether bytes contain valid JSON
Check whether bytes contain valid JSON using a complete Go program with explicit sample inputs.
Go✓ Tested
Choose a branch with if and else
Choose a branch with if and else using a complete Go program with explicit sample inputs.
Go✓ Tested
Choose floating-point division
Choose floating-point division using a complete Go program with explicit sample inputs.
Go✓ Tested
Clamp a value to an allowed interval
Clamp a value to an allowed interval using a complete Go program with explicit sample inputs.
Go✓ Tested
Clear all map entries
Clear all map entries using a complete Go program with explicit sample inputs.
Go✓ Tested
Clone a map before editing it
Clone a map before editing it using a complete Go program with explicit sample inputs.
Go✓ Tested
Combine independent validation errors
Combine independent validation errors using a complete Go program with explicit sample inputs.
Go✓ Tested
Combine two Boolean conditions
Combine two Boolean conditions using a complete Go program with explicit sample inputs.
Go✓ Tested