Block is a chunk of code that tags along right after a method call. You'll run into blocks constantly with Ruby iterators, file handling, and callbacks. If you want to run a block from inside a method, that's what yield is for.
ruby
def with_loading
puts "Loading..."
yield
puts "Done!"
end
with_loading do
puts "Fetching user data"
endwith_loading method, you're also handing it a block. Wherever yield shows up inside the method, that's where the block's code runs.
You should see
Loading... Fetching user data Done!Info
Calling yield without a block can throw an error. If you need to, you can check first with block_given?.