io

Module

Provides utilities for working with input/output.

These are Mojo built-ins, so you don’t need to import them.

put_new_line

put_new_line()

Prints a new line character.

print

print()

Prints a newline.

print(t: DType)

Prints a DType.

Args:

  • t (DType): The DType to print.

print(x: String)

Prints a string.

Args:

  • x (String): The string to print.

print(x: StringRef)

Prints a string.

Args:

  • x (StringRef): The string to print.

print(x: StringLiteral)

Prints a string.

Args:

  • x (StringLiteral): The string to print.

print(x: Bool)

Prints a boolean value.

Args:

  • x (Bool): The value to print.

print(x: FloatLiteral)

Prints a float literal.

Args:

  • x (FloatLiteral): The value to print.

print(x: Int)

Prints an integer value.

Args:

  • x (Int): The value to print.

print[simd_width: Int, type: DType](vec: SIMD[type, simd_width])

Prints a SIMD value.

Parameters:

  • simd_width (Int): The SIMD vector width.
  • type (DType): The DType of the value.

Args:

  • vec (SIMD[type, simd_width]): The SIMD value to print.

print[simd_width: Int, type: DType](vec: ComplexSIMD[type, simd_width])

Prints a SIMD value.

Parameters:

  • simd_width (Int): The SIMD vector width.
  • type (DType): The DType of the value.

Args:

  • vec (ComplexSIMD[type, simd_width]): The complex value to print.

print[type: DType](x: Atomic[type])

Prints an atomic value.

Parameters:

  • type (DType): The DType of the atomic value.

Args:

  • x (Atomic[type]): The value to print.

print[length: Int](shape: DimList)

Prints a DimList object.

Parameters:

  • length (Int): The length of the DimList.

Args:

  • shape (DimList): The DimList object to print.

print(obj: object)

Prints an object type.

Args:

  • obj (object): The object to print.

print(*elements: _Printable)

Prints a sequence of elements, joined by spaces, followed by a newline.

Args:

  • elements (*_Printable): The elements to print.