R.apex

  • Docs
  • Tutorials
Docs Menu
  • Func
  • R.Funcs
    • Conversion Funcs
    • Arithmetic Funcs
    • Logic Funcs
    • Relation Funcs
    • Function Funcs
    • Comparator Funcs
    • Condition Funcs
    • List Funcs
    • String Funcs
    • Map Funcs
    • Utility Funcs
    • Database Funcs
  • R.Instance
    • Creation Methods
    • Conversion Methods
    • Methods

Logic Funcs Guide

Logic Funcs in R

allPass

Create a function that combines all predicates with 'and'.

Func f = (Func)R.allPass.run(
    R.startsWith.apply('c'),
    R.endsWith.apply('t')
);
system.debug(f.run('cat'));
// true

anyPass

Create a function that combines all predicates with 'or'.

Func f = (Func)R.anyPass.run(
    R.startsWith.apply('c'),
    R.endsWith.apply('t')
);
system.debug(f.run('cc'));
// true

complement

Create a function that negate the predicate.

Func f = (Func)R.complement.run(R.equals.apply('cat'));
system.debug(f.run('cat'));
// false

doAnd

Test logic 'and'.

R.doAnd.run(true, false)
// false

doNot

Test logic 'not'.

R.doNot.run(false)
// true

doOr

Test logic 'or'.

R.doOr.run(true, false)
// true

Contribute on Github! Edit this section.