Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 546 Bytes

rust-null-value-example.md

File metadata and controls

17 lines (11 loc) · 546 Bytes

Rust null value example

// plain

Null values in Rust are represented by the Option enum. Option is an enum with two variants, Some and None. Some is used to wrap a value, while None is used to indicate the absence of a value.

Example code

let x: Option<i32> = None;

This code creates a variable x of type Option<i32> and assigns it the value None. This indicates that x does not have a value.

Helpful links

group: rust-null