Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions kotlin/Program2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Q2. Write a program to plus and minus with sample of extension function from kotlin
15 changes: 15 additions & 0 deletions kotlin/Program2/extension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fun main(args: Array<String>) {
println("Basic Extension Function")
val plus = 2.plusNumber(2)
val minus = 2.minusNumber(2)
println("2 + 2 : $plus")
println("2 - 2 : $minus")
}

fun Int.plusNumber(number: Int): Int {
return this + number
}

fun Int.minusNumber(number: Int): Int {
return this - number
}
1 change: 1 addition & 0 deletions kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
| Program No.| Question |
| ------- | ------ |
| [Program-1](https://github.com/swaaz/basicprograms/blob/814a1e60ae23d81158d8174666f23c9b7419e15e/kotlin/Program1/pattern.kt) | Write a program to print half pyramid using ' * '
| [Program-2](https://github.com/swaaz/basicprograms/blob/814a1e60ae23d81158d8174666f23c9b7419e15e/kotlin/Program2/extension.kt) | Q2. Write a program to plus and minus with sample of extension function from kotlin

</div>