Skip to content

Instantly share code, notes, and snippets.

@davidmigloz
Last active April 20, 2021 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidmigloz/acb7bb329ef565fa7e498f58fbf6604f to your computer and use it in GitHub Desktop.
Save davidmigloz/acb7bb329ef565fa7e498f58fbf6604f to your computer and use it in GitHub Desktop.
Dart vs Kotlin: strings
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';
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