Skip to content

Instantly share code, notes, and snippets.

@xmeta
Created March 14, 2020 06:55
Show Gist options
  • Save xmeta/025bfd6d97a9599823bcf7da05335b39 to your computer and use it in GitHub Desktop.
Save xmeta/025bfd6d97a9599823bcf7da05335b39 to your computer and use it in GitHub Desktop.
enum Color {
red
blue
green
}
struct Rgb{
r int
g int
b int
}
type MColor = Color | Rgb
fn is_red_or_blue(c MColor) bool {
return match c {
Color {
match it {
.red {true}
.blue {false}
else {false}
}
}
Rgb { true }
else {false}
}
}
fn main() {
print(is_red_or_blue(Color.red))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment