Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Use a Do Block Without a Catch Block
Copy link
Facebook
Email
Notes
More

Use a Do Block Without a Catch Block

Daily Coding Tip 266

Type Safely's avatar
Type Safely
Mar 15, 2023
∙ Paid

Share this post

Type Safely
Type Safely
Use a Do Block Without a Catch Block
Copy link
Facebook
Email
Notes
More
Share
text
Photo by Brett Jordan on Unsplash

It might seem pointless to create a do block on its own, because the lines of code will be run sequentially.

But it’s useful to have a very restrictive view of scope in an app. Whatever happens in a do block stays in that do block, which includes the creation of any variables. This is useful when you don’t want to get con…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More