• 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

Preliminary Knowledge

It's recommended that you have a fair amount of knowledge on R.apex, but it's not required.

Flow.apex uses Func objects from R.apex, and a Func is actually a custom Apex object that mimics the behavior of a function.

Here is how your implement a custom Func.

public class HelloWorldFunc extends Func {
    public HelloWorldFunc() {
        super(0); // specify the number of arguments the Func takes
    }

    // Provide custom implementation for a Func that takes 0 arguments.
    public override Object exec() {
        return 'Hello World';
    }
}

And then you instantiate, and invoke it.

Func helloworld = new HelloWorldFunc();
String msg = (String)helloworld.run();

To get deeper with Func objects, please check R.apex.

Done