0Pricing
Mojo Academy · Lesson

Taking Ownership with owned

Transfer a value into a function.

A Third Way to Pass

You have borrowed for reading and inout for editing. The third convention lets a function take over a value entirely. 📦

Meet owned

An owned argument transfers ownership into the function. The function now holds the value as its very own to use or store.

All lessons in this course

  1. Borrowing Arguments Read-Only
  2. Mutating in Place with inout
  3. Taking Ownership with owned
  4. The Transfer Operator
← Back to Mojo Academy