Created
October 13, 2011 17:10
-
-
Save dora-gt/1284827 to your computer and use it in GitHub Desktop.
samples of String interpolation with ${expression}
This file contains 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
main () { | |
var age = 21; | |
var name = {"first":"taro","last":"yamada"}; | |
print ("Happy birthday, ${name['first'].toUpperCase()}, you're ${age++} today."); | |
} |
This file contains 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
main () { | |
var age = 21; | |
var name = {"first":"taro","last":"yamada"}; | |
print ("Happy birthday, ${getFirstName(var name){return name['first'];}(name)}, you're ${age++} today."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment