SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
1
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#if-let
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
Rust
if let / while let
When you only care about one variant, `if let` is shorter than `match`. `while let` keeps looping as long as the pattern matches — great for draining iterators or option-returning APIs.
#rust
#pattern-matching
#if-let
#let-else