Simple options - vilinski/nemerle GitHub Wiki
Simple options
- Category: Lists, Tuples and Options
 - Description: Create some optional values, print them and match on them.
 - Code:
 
using Nemerle;
using Nemerle.Collections;
using System;
using System.Console;
def data = Some(1, 3);
WriteLine($"data = $data");
WriteLine($"data.IsSome = $(data.IsSome)"); 
WriteLine($"data.IsNone = $(data.IsNone)");
WriteLine($"data.Value = $(data.Value.ToString())"); 
def data2 = None();
WriteLine($"data2.IsSome = $(data2.IsSome)"); 
WriteLine($"data2.IsNone = $(data2.IsNone)")
- Execution Result:
 
data = Some ((1, 3))
data.IsSome = True
data.IsNone = False
data.Value = (1, 3)
data2.IsSome = False
data2.IsNone = True
[Copyright ©](Terms of use, legal notice)