Ownership and Borrowing
Medium
+3 pts
Intro to Rust
11/15
🎯 In Python, you never think about who "owns" a value:
def label(item): return f"Product: {item}" item = "Laptop" tag = label(item) print(item) # still works — item wasn't consumed
Every variable is a reference to a garbage-collected object. Pass it to a function, return it, store it — the GC handles cleanup.
Rust has no garbage collector. Instead, it uses ownership — every value has exactly one owner, and when the owner goes out of scope, …
Login to see the full exercise.
Topics