RosettaCodeData/Task/Assertions/Nemerle/assertions-2.nemerle
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

13 lines
551 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
}