diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..ccb6138 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Main.kt \ No newline at end of file diff --git a/Lambda/Lambda.iml b/Lambda/Lambda.iml new file mode 100644 index 0000000..93cddcd --- /dev/null +++ b/Lambda/Lambda.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Lambda/calculateDepth.kt b/Lambda/calculateDepth.kt new file mode 100644 index 0000000..8a6ce41 --- /dev/null +++ b/Lambda/calculateDepth.kt @@ -0,0 +1,5 @@ +val calculateDepth: (Int, Int) -> Int = { location1, location2 -> location1 - location2 } +fun main (){ + val result = calculateDepth(1500, 800) + println(result) +} \ No newline at end of file diff --git a/Lambda/divideTreasure.kt b/Lambda/divideTreasure.kt new file mode 100644 index 0000000..c549c19 --- /dev/null +++ b/Lambda/divideTreasure.kt @@ -0,0 +1,5 @@ +val divideTreasure: (Double, Double) -> Double= {treasure, explorers -> treasure / explorers} +fun main(){ + val result = divideTreasure(1000.0, 5.0) + println("$result") +} \ No newline at end of file diff --git a/Lambda/extensionFunction.kt b/Lambda/extensionFunction.kt new file mode 100644 index 0000000..b11ff70 --- /dev/null +++ b/Lambda/extensionFunction.kt @@ -0,0 +1,7 @@ +fun String.loud(): String { + return this.uppercase() + "!" +} +val diveMessage: (String) -> String = {text -> text.loud()} +fun main(){ + println(diveMessage("deep sea")) +} \ No newline at end of file diff --git a/Lambda/findPearl.kt b/Lambda/findPearl.kt new file mode 100644 index 0000000..3ba0f55 --- /dev/null +++ b/Lambda/findPearl.kt @@ -0,0 +1,5 @@ +val findPearl: (Int) -> Int = {pearls -> pearls * pearls} +fun main () { + val result = findPearl(6) + println(result) +} \ No newline at end of file diff --git a/Lambda/greatSeaCreatures.kt b/Lambda/greatSeaCreatures.kt new file mode 100644 index 0000000..f568aa0 --- /dev/null +++ b/Lambda/greatSeaCreatures.kt @@ -0,0 +1,6 @@ +val greetSeaCreatures: () -> Unit = { + println("Hello, Deep Sea Adventurer!\n") +} +fun main (){ + greetSeaCreatures() +} \ No newline at end of file diff --git a/Lambda/src/Main.java b/Lambda/src/Main.java new file mode 100644 index 0000000..d5238c9 --- /dev/null +++ b/Lambda/src/Main.java @@ -0,0 +1,5 @@ +public class Main { + public static void main(String[] args) { + System.out.println("Hello, World!"); + } +} \ No newline at end of file