Conditional Comparison Plugin...
Posted: February 4th, 2010, 2:42 am
A useful plugin I find myself wanting, and am surprised has not yet been done. Inline Boolean comparisons.
$dll(compare, func, x, y)
func 1: (x == y)
func 2: (x != y)
func 3: (x < y)
func 4: (x <= y)
func 5: (x > y)
func 6: (x >= y)
The following code was modified from krisp's "if" plugin and ought to do it, but I'm not sure if I have the means to compile it myself, and I don't have the free time to try at the moment. Someone else who already knows how should be able to get it to compile pretty easily. It'd be greatly appreciated.
Thanks in advance!
~ Jake
$dll(compare, func, x, y)
func 1: (x == y)
func 2: (x != y)
func 3: (x < y)
func 4: (x <= y)
func 5: (x > y)
func 6: (x >= y)
The following code was modified from krisp's "if" plugin and ought to do it, but I'm not sure if I have the means to compile it myself, and I don't have the free time to try at the moment. Someone else who already knows how should be able to get it to compile pretty easily. It'd be greatly appreciated.
Code: Select all
using System;
namespace @compare
{
public class LCDSmartie
{
// Equality comparison
public int function1(int x, int y)
{
try
{
if(x == y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
// inequality comparison
public int function2(int x, int y)
{
try
{
if(x != y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
// Less than comparison
public int function1(int x, int y)
{
try
{
if(x < y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
// Less than or Equal comparison
public int function1(int x, int y)
{
try
{
if(x <= y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
// Greater than comparison
public int function1(int x, int y)
{
try
{
if(x > y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
// Greater than or Equal comparison
public int function1(int x, int y)
{
try
{
if(x >= y)
return 1;
else
return 0;
}
catch (Exception e)
{
return e.ToString();
}
}
}
}
~ Jake