سؤال

I am confused about the difference between the branch and the predicate in a code. Can someone explain the difference with an example?

هل كانت مفيدة؟

المحلول

A predicate returns a yes/no answer to a question - that is, a boolean conditional.

A branch is what you do depending on the answer (assuming you do different things).

So, in c type pseudo code:

if(predicate)
{
  // one branch
}
else
{
  // another branch
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top