diff --git a/code/tuple-return.kt b/code/tuple-return.kt index 6568659..bf0de1d 100644 --- a/code/tuple-return.kt +++ b/code/tuple-return.kt @@ -1,8 +1,5 @@ -// Kotlin doesn't have tuples, use data classes -data class GasPrices(val a: Double, val b: Double, val c: Double) +fun getGasPrices() = Triple(3.59, 3.69, 3.79) -fun getGasPrices() = GasPrices(3.59, 3.69, 3.79) +val prices = getGasPrices() -val prices = getGasPrices(); - -val (a, b, c) = getGasPrices(); \ No newline at end of file +val (a, b, c) = getGasPrices() \ No newline at end of file diff --git a/index.html b/index.html index 48b4a49..7262f13 100644 --- a/index.html +++ b/index.html @@ -251,14 +251,11 @@ val result2 = transform("hello") { x -> x.toUpperCase() }
string Transform(string initial, Func<string, string> f) => f(initial);
var result = Transform("hello", x => x.ToUpper());
-// HELLO// Kotlin doesn't have tuples, use data classes
-data class GasPrices(val a: Double, val b: Double, val c: Double)
+// HELLOfun getGasPrices() = Triple(3.59, 3.69, 3.79)
-fun getGasPrices() = GasPrices(3.59, 3.69, 3.79)
+val prices = getGasPrices()
-val prices = getGasPrices();
-
-val (a, b, c) = getGasPrices();(double a, double b, double c) GetGasPrices() => (3.59, 3.69, 3.79);
+val (a, b, c) = getGasPrices()(double a, double b, double c) GetGasPrices() => (3.59, 3.69, 3.79);
var result = GetGasPrices();