Skip to content

Instantly share code, notes, and snippets.

@ceylonwebide
Created September 26, 2015 20:52
Show Gist options
  • Save ceylonwebide/2aaab60d0ddd6b83baec to your computer and use it in GitHub Desktop.
Save ceylonwebide/2aaab60d0ddd6b83baec to your computer and use it in GitHub Desktop.
Ceylon Web Runner: strings.ceylon
//$webrun_wrapped
shared void run() {
//Strings come in two forms, ordinary, single-quoted strings,
//where backslashes represent escapes:
print("Hello\nworld");
//And "verbatim" strings, where quotes and backslashes are
//interpreted literally:
print("""Hello\nworld""");
//String literals can span multiple lines:
print("Hello
world");
print("""Hello
world""");
//We can use the + operator to concatenate strings:
value strings = {"world", "everyone"};
for (who in strings) {
print("Hello " + who);
}
//String interpolation allows us to write expressions within
//a string literal:
for (who in strings) {
print("Hello ``who``");
}
}
@ceylonwebide
Copy link
Author

Click here to run this code online

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment