Registry Synced

Functions

102 words
1 min read

Functions

Functions package a small idea behind a name.

Contract

A function should have a clear contract:
  • What inputs it accepts.
  • What output it returns.
  • What assumptions it makes.
python
def double(x):
    return x * 2
The function receives x, computes x * 2, and sends that result back to the caller.

Return is not print

return gives a value back to the program. print shows a value to the human.
python
answer = double(5) + 1
double(5) returns 10, so answer becomes 11.

Practice

Write a one-sentence contract before coding a function.
Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.