// Pattern Matching - Match expressions with algebraic enums
import Std::Io::{PrintLine, PrintInt};


enum Option {
    Some(int),
    None
}

func GetValue(opt: Option) -> int {
    match opt {
        Option::Some(value) => opt.data.Some_0,
        Option::None => 0
    }
}

func Main() -> int {
    let opt1: Option = Option { tag: Option_Some };
    opt1.data.Some_0 = 42;
    
    let opt2: Option = Option { tag: Option_None };
    
    PrintLine("opt1 value: ");
    PrintInt(GetValue(opt1));
    PrintLine("");
    
    PrintLine("opt2 value: ");
    PrintInt(GetValue(opt2));
    PrintLine("");
    
    return 0;
}
