Last active
April 20, 2021 07:50
-
-
Save davidmigloz/acb7bb329ef565fa7e498f58fbf6604f to your computer and use it in GitHub Desktop.
Dart vs Kotlin: strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String singleQuotes = 'Double quotes in "single" quotes'; | |
String doubleQuotes = "Single quotes in 'double' quotes"; | |
String multiLine = ''' | |
{ | |
"field": "value" | |
} | |
'''; | |
String concat = 'Dart ' + 'is ' + 'fun!'; | |
String concatV2 = 'Dart ' 'is ' 'fun!'; | |
String answer = 'awersome'; | |
String valueInterpolation = 'Dart is $answer!'; | |
String resultInterpolation = 'Dart is ${getAnswer()}!'; | |
} | |
String getAnswer() => 'awersome'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
var singleQuotes: String = "Double quotes in \"double\" quotes" | |
var doubleQuotes: String = "Single quotes in 'double' quotes" | |
var multiLine: String = """ | |
{ | |
"field": "value" | |
} | |
""" | |
var concat: String = "Dart " + "is " + "fun!" | |
var answer = "awersome" | |
var valueInterpolation: String = "Dart is $answer!" | |
var resultInterpolation: String = "Dart is ${getAnswer()}!" | |
} | |
fun getAnswer() = "awersome" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment