AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Minimizing if statements
 
 

Is there any way to reduce the if statement by using something similar to the following code?

concept: ~food [~meat ~veggies]

s
: (My favorite food is _*) if ( _0 == ~meat { Meat-eater huh

Currently the equal statement only works if _0 = actual text ~meat. Otherwise, I have to create separate if clauses for each item of meat.

 

 
  [ # 1 ]

your pattern will never match (you should not capitalize My because the word you want is my - the fact that a sentence begins with a capital letter is immaterial. You want the lower case for matching.

s: (my favorite food is _*)  if (_0 ? ~meat) {Meat-eater huh?}

or

s: ( my favorite food is _~meat) Meat-eater huh?

 

 
  [ # 2 ]

Thanks. Dont know why I forgot that concepts can be used in patterns. I DO have a medically related memory issue though.

Could you please remind me what the ? operator does besides specifying a question input…

 

 
  login or register to react