LEARN VOID / FOUNDATIONS

Modules & imports

Organize a program into small source files.

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

main.voidDownload source
use "/pricing.void" as pricing
use "./delivery.void"

func entry(items: i32) -> i32:
    return pricing.subtotal(items) + delivery_fee()
Input 5Expected result 23

Keep all three files together

Download the entry file and both supporting sources below. Save them in one directory with the displayed filenames. The entry file’s parent establishes the virtual project root.

main.void
pricing.void
delivery.void
pricing.voidDownload source
func subtotal(items: i32) -> i32:
    return items * 4
delivery.voidDownload source
func delivery_fee() -> i32:
    return 3

Use qualified and direct names

The absolute project-root import is aliased as pricing, so its function is called as pricing.subtotal. The relative delivery import exposes its unambiguous name directly. Five items at four plus delivery of three return 23.

Read paths in project context

A leading slash refers to the virtual project root, not the operating-system root. A ./ path resolves from the importing file. Exact-case .void filenames and forward slashes are required; package imports and escapes outside the project root are not supported.