Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
21
Task/Null-object/Lily/null-object.lily
Normal file
21
Task/Null-object/Lily/null-object.lily
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
enum class Option[A] {
|
||||
Some(A)
|
||||
None
|
||||
}
|
||||
|
||||
# Only variables of class Option can be assigned to None.
|
||||
|
||||
# Type: Option[integer]
|
||||
var v = Some(10)
|
||||
|
||||
# Valid: v is an Option, and any Option can be assigned to None
|
||||
v = None
|
||||
|
||||
# Invalid! v is an Option[integer], not just a plain integer.
|
||||
v = 10
|
||||
|
||||
# Type: integer
|
||||
var w = 10
|
||||
|
||||
# Invalid! Likewise, w is an integer, not an Option.
|
||||
w = None
|
||||
Loading…
Add table
Add a link
Reference in a new issue