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
//$webrun_wrapped | |
shared void run() { | |
//You can use normal conditions as in any other language | |
value nums = 1..10; | |
if (nums.size == 10) { | |
print("ok, normal condition"); | |
} | |
if (nums.size == 10 && nums.first == 1) { | |
print("another normal condition"); | |
} |
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
//$webrun_wrapped | |
shared void run() { | |
// The following is an error because null is not a String. | |
//String s = null; //ERROR! | |
// We have to write "String?" instead: | |
String? s1 = null; | |
String? s2 = "This is a String."; | |
print(s1); |
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
//$webrun_wrapped | |
shared void run() { | |
// Any object can be converted to a string using ".string". | |
// There are no special primitive types, even numbers are objects. | |
Integer i = 3; | |
String s = i.string; | |
"Declarations can be documented using the `doc` annotation. | |
Note that string literals can span several lines." | |
Boolean b = (i == 3); |
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
//$webrun_wrapped | |
shared void run() { | |
// The classic "hello world" in Ceylon | |
print("Hello world!"); | |
// Click 'Run' above to run the program. | |
// It is compiled to JavaScript and then runs directly in your browser! | |
// You can try the more examples from the list on the right of this page |
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
{ | |
"sets": [ | |
{ | |
"title": "Try out a sample:", | |
"items": [ | |
{ | |
"title": "Hello World", | |
"gist": "1b5a174b7fda6eb0e3a6" | |
}, | |
{ |
NewerOlder