Results for “Functions & data types”
Small, practical examples. Search by task or narrow things down below.
Accept a variable number of arguments
Accept a variable number of arguments using a complete Go program with explicit sample inputs.
Go✓ Tested
Attach behavior to a struct
Attach behavior to a struct 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
Define related integer constants
Define related integer constants using a complete Go program with explicit sample inputs.
Go✓ Tested
Embed a struct for shared fields
Embed a struct for shared fields using a complete Go program with explicit sample inputs.
Go✓ Tested
Inspect a value with a type switch
Inspect a value with a type switch using a complete Go program with explicit sample inputs.
Go✓ Tested
Mutate a struct through a pointer receiver
Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.
Go✓ Tested
Write a generic slice helper
Write a generic slice helper using a complete Go program with explicit sample inputs.
Go✓ Tested
Return typed data from an async function
Await a Promise and handle failures explicitly.
async✓ Tested
Associate a data cell with explicit table headers
HTML: The headers attribute lists header IDs for a more complex cell association.
HTML✓ Tested
Attach a custom data attribute
HTML: Learn how to attach a custom data attribute in a complete browser example.
HTML✓ Tested
Bind a custom data attribute
Bind a custom data attribute with a standalone Angular component and explicit browser behavior.
Angular✓ Tested