FIND YOUR NEXT FEW LINES

Results for “Functions & data types”

Small, practical examples. Search by task or narrow things down below.

787 snippets foundClear filters
GoFunctions & types

Accept a variable number of arguments

Accept a variable number of arguments using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Attach behavior to a struct

Attach behavior to a struct using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Capture state in a closure

Capture state in a closure using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Define related integer constants

Define related integer constants using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Embed a struct for shared fields

Embed a struct for shared fields using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

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
GoFunctions & types

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
GoFunctions & types

Write a generic slice helper

Write a generic slice helper using a complete Go program with explicit sample inputs.

Go✓ Tested
TypeScriptUtilities & async

Return typed data from an async function

Await a Promise and handle failures explicitly.

async✓ Tested
HTMLTables & list numbering

Associate a data cell with explicit table headers

HTML: The headers attribute lists header IDs for a more complex cell association.

HTML✓ Tested
HTMLGetting Started

Attach a custom data attribute

HTML: Learn how to attach a custom data attribute in a complete browser example.

HTML✓ Tested
AngularTemplates & bindings

Bind a custom data attribute

Bind a custom data attribute with a standalone Angular component and explicit browser behavior.

Angular✓ Tested