Files
test/guide/language/imports.zig
2026-01-19 05:43:29 +09:00

15 lines
622 B
Zig

const std = @import("std");
const expect = std.testing.expect;
const math = std.math;
// The built-in function `@import` takes in a file, and gives you a struct type based on that file.
// All declarations labelled as `pub` (for public) will end up in this struct type, ready for use.
// `@import("std")` is a special case in the compiler, and gives you access to the standard library.
// Other `@import`s will take in a file path, or a package name (more on packages in a later chapter).
// We will explore more of the standard library in later chapters.
test "imports" {
try expect(math.pow(f32, 2, 3) == 8.0);
}