Skip to content

Commit 78d7035

Browse files
committed
more extension cleanup
1 parent a2cc64c commit 78d7035

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/kotlin/me/kotlindemo/03_extensions.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ fun main() {
1717
val randy = "Randy!"
1818

1919
/**
20+
* Extension functions allow us to add features to 3rd party stuff (types)
2021
* Receiver type is the class getting extended, ie 'String' in this example
21-
* this fun returns a type 'Sring'
22+
* this fun returns a type 'String'
2223
* this will show up in autocomplete
23-
* ingore intellij warning for now about String. receiver param not used
24+
* ignore intellij warning for now about String. receiver param not used
25+
* can be invoked from java but kinda messy
2426
*/
2527
fun String.doodify() : String = "doood!" //adds the fun 'doodify' to all string objects in this module, can use block body too
2628

0 commit comments

Comments
 (0)