LEARN VOID / 01

Syntax basics

Read your first VOID program.

Complete program for the synchronous entry adapter. The result below is the returned integer.

syntax.voidDownload source
# Three items fit in each box.
func entry(boxes: i32) -> i32:
    return boxes * 3
Input 4Expected result 12

Read the function declaration

func entry(boxes: i32) -> i32: names a function, its integer input and its integer result. Here a box holds three items, so four boxes produce 12 items.

Use indentation for the body

The colon starts the body; indent its statements by four spaces. return boxes * 3 calculates and returns the item count. Ordinary blocks need no braces or statement-ending semicolons. A # comment explains the idea without affecting execution.

Understand the entry adapter

The current command-line adapter passes one i32 input to entry and displays its returned integer. These complete examples use that adapter rather than an invented printing API. Use descriptive lowercase snake_case names.