Scope function thực thi một block code trên một object trong một scope tạm thời. let chạy code chỉ khi object khác null (trả về kết quả lambda). run giống let nhưng dùng this thay vì tham số. apply cấu hình object và trả về chính object đó (dùng khi khởi tạo). also giống apply nhưng truyền object vào làm tham số. with giống run nhưng cú pháp khác.
Chọn loại dựa vào nhu cầu null-safety, giá trị trả về, hay cách tham chiếu object.
Scope functions execute code on an object within a temporary scope. let executes code only if non-null (returns lambda result). run is like let but uses this. apply configures and returns the object (good for initialization). also is like apply but passes object as parameter. with is like run but called differently.
Choose based on null safety, return value, or object reference needs.