RosettaCodeData/Task/Assertions/Nemerle/assertions-2.nemerle
2026-04-30 12:34:36 -04:00

13 lines
563 B
Text

using Nemerle.Assertions;
class SampleClass
{
public SomeMethod (input : list[int]) : int
requires input.Length > 0 // requires keyword indicates precondition,
// there can be more than one condition per method
{ ... }
public AnotherMethod (input : string) : list[char]
ensures value.Length > 0 // ensures keyword indicates postcondition
{ ... } // value is a special symbol that indicates the method's return value
}