You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.
An unwrap (?) operator should return early from the function if supplied expression is resulted in none. This could help avoiding writing if x != none everywhere.
Example:
def read_contents() {
let file = File.open('test.bin')?; # may return early if File.open resulted in `none`
let data = file.read()?; # may return early if File.read resulted in `none`
return data;
}
Alternate syntax: The try keyword can be used for unwrapping as an unary operator.
The text was updated successfully, but these errors were encountered:
An unwrap (
?
) operator should return early from the function if supplied expression is resulted innone
. This could help avoiding writingif x != none
everywhere.Example:
Alternate syntax: The
try
keyword can be used for unwrapping as an unary operator.The text was updated successfully, but these errors were encountered: