50 lines
898 B
Plaintext
50 lines
898 B
Plaintext
/*import io:**/
|
|
|
|
adt options {
|
|
option0,
|
|
option1
|
|
}
|
|
|
|
adt maybe_int {
|
|
no_int,
|
|
an_int: int
|
|
}
|
|
|
|
fun handle_possibility(it: maybe_int) {
|
|
if (it == maybe_int::no_int()) {
|
|
/*println("no int")*/
|
|
}
|
|
/*if (it == maybe_int::an_int) {*/
|
|
else {
|
|
/*print("an int: ")*/
|
|
/*println(it.an_int)*/
|
|
}
|
|
}
|
|
|
|
fun give_maybe(give_it: bool): maybe_int {
|
|
if (give_it)
|
|
return maybe_int::an_int(7)
|
|
return maybe_int::no_int()
|
|
}
|
|
|
|
fun can_pass(it: options): options {
|
|
return it
|
|
}
|
|
|
|
fun main():int {
|
|
var it: options = can_pass(options::option0())
|
|
if (it == options::option0()) {
|
|
/*println("nope")*/
|
|
}
|
|
if (it == options::option1()) {
|
|
/*println("option1")*/
|
|
}
|
|
|
|
var possibility = give_maybe(false)
|
|
handle_possibility(possibility)
|
|
possibility = give_maybe(true)
|
|
handle_possibility(possibility)
|
|
return 0
|
|
}
|
|
|