Skip to content

Define operator inline function

CodingUnit edited this page Jan 9, 2012 · 6 revisions

Define operator - inline function

  • Category: Defining Operator
  • Description: Define operator using inline function
  • Code:
using Nemerle;
using System;
using System.Console;

module Inline
{
  public @%++(a : int, b : int) : int
  {
    a + b * 2
  }
  
}

using Inline;

def a = 9;
def r = a %++ 4;
WriteLine(r);
WriteLine(if (r == 17) "both elements are equal" else "elements not equal");
  • Execution Result:
17
both elements are equal
Clone this wiki locally