Skip to content

Instantly share code, notes, and snippets.

@Jesus
Last active November 7, 2019 09:52
Show Gist options
  • Select an option

  • Save Jesus/fbd300ef6a5149cb67aa5a4b809db110 to your computer and use it in GitHub Desktop.

Select an option

Save Jesus/fbd300ef6a5149cb67aa5a4b809db110 to your computer and use it in GitHub Desktop.

Revisions

  1. Jesus revised this gist Nov 7, 2019. No changes.
  2. Jesus revised this gist Nov 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion return_type.kt
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ fun hithere(): String {
    }

    fun main() {
    val a = hithere(3)
    val a = hithere(3)
    val b = hithere()

    println("a is: ${a::class.simpleName}") // => "a is: Int"
  3. Jesus created this gist Nov 7, 2019.
    15 changes: 15 additions & 0 deletions return_type.kt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    fun hithere(n: Int): Int {
    return n
    }

    fun hithere(): String {
    return "I'm not a number!"
    }

    fun main() {
    val a = hithere(3)
    val b = hithere()

    println("a is: ${a::class.simpleName}") // => "a is: Int"
    println("b is: ${b::class.simpleName}") // => "b is: String"
    }