• 1Installation
  • 2Preliminary Knowledge
  • 3FlowScript
  • 4Flow Func Signature
  • 5Variable Assignment
  • 6Function Invocation
  • 7Return Statement
  • 8If Block
  • 9For Block
  • 10While Block
  • 11Break and Continue
  • 12Switch Block
  • 13Recursion
  • 14Flow Debug

Flow.apex

  • Docs
  • Tutorials
Getting started with Flow.apex

Return Statement

returnXxx in Flow.apex only specifies what type of result is returned. To actually return something, call doReturn(Object) or doReturnRaw(Object).

Flow f = new Flow()
    .inputAs('a', 'b').returnInteger()
    .doReturn(0);

If no doReturn or equivalent is added, the Flow Func will return null.

The difference between doReturn and doReturnRaw is that doReturn treats String as FlowScript while doReturnRaw does not.

Flow f = new Flow()
    .inputAs('a', 'b').returnInteger()
    .doReturn('"message"');

is equivalent to

Flow f = new Flow()
    .inputAs('a', 'b').returnInteger()
    .doReturnRaw('message');
Done