apply vs with

we use apply when we need to perform some operation on a object and return it.

We use with when we need to perform some operation on a object and return some other object.

Difference between apply vs with

apply function will take instance as an receiver while with function we need to pass instance as an argument.But in both case the instance will be refered with this inside the block

Example of apply

Example of with

Knowledge is everything.Check out my app at https://play.google.com/store/apps/details?id=com.vibe.britevibe

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

BASIC- INTRO-ABOUT-HTML-CSS

Message to LinkedIn group members doesn’t work

Hacking into Admin Panel of U.S Federal government system : C.A.R.S -without credentials.

RxJava 2 | Android : How to properly handle rotations with ConnectableObservable & Loader

What is Javascript?

Build A Bot (DiscordJS) — Better Logging And A Persistent Bot Config

Vue, the webby framework

“Hello world!” app with Deno

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pandiyan Mani

Pandiyan Mani

Knowledge is everything.Check out my app at https://play.google.com/store/apps/details?id=com.vibe.britevibe

More from Medium

Write Test for Authenticated Requests in Ktor

Coroutines: Launching flows. How should flows be collected?

Android library distribution with multiple modules and flavors to Maven Central

Received status code 502 from server: Bad Gateway Enable Gradle ‘offline mode’ and sync project