Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using OR-statement in .RUL file #12

Open
TristanHam123 opened this issue Sep 9, 2019 · 2 comments
Open

Using OR-statement in .RUL file #12

TristanHam123 opened this issue Sep 9, 2019 · 2 comments

Comments

@TristanHam123
Copy link

I'm trying to do more complex logic in the .rul file and I don't see any documentation explaining OR-statements and I've tried a few things by trial-and-error and none are working. Could you write out a simple example that uses an OR-statement in the .RUL file, please?

@snikolayev
Copy link
Member

OR is not yet supported in NRules.Language. It's only supported in the C# DSL. I'll consider this a feature request.

@mayshen
Copy link

mayshen commented Oct 25, 2022

Hi, I'm May, a beginner in NRule.
I have a similar question.
I was wondering if I want to implement the statement like this:

var optionList = new List<string> {"aa","bb","cc","dd","ee"};
//if customer's code is in optionList.
if (optionList.Contains(customer.code))
{
	//do something;
}

How should I do?
Sorry about that I don't see any documentation explaining it.
I'm trying to do something, but it doesn't work.

rule "Test_Rule"
when
	var optionList = new List<string> {"aa","bb","cc","dd","ee"};
	var customer = Customer(x =>optionList.Contains(x.code));
then
	DoSomething();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants