From b3b51ffc259e033d75f1865340d192854035e1cd Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 30 Aug 2022 05:58:32 +0000 Subject: [PATCH] Update 'Return Direction' --- Return-Direction.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Return-Direction.md diff --git a/Return-Direction.md b/Return-Direction.md new file mode 100644 index 0000000..42baac3 --- /dev/null +++ b/Return-Direction.md @@ -0,0 +1,19 @@ +The way ARF handles return values from functions is different from other +languages, and is greatly enhanced by its ability to define variables in-place. It +is done by placing an arrow called a return direction after the [phrase](Phrases): + +`file.write bytes -> bytesWritten:Size err` + +The advantage of this is a new variable can be defined without having to +re-define and therefore shadow `err`, sidestepping a major problem that Go has. + +If a phrase is enclosed in brackets, the return direction arrow lies outside of +them: + +`[file.write bytes] -> bytesWritten:Size err` + +Return direction cannot be used with phrases that are already being used as +arguments. Its one of those things that, very elegantly, makes no sense +conceptually or syntactically. + +Return directions are terminated by a line break. \ No newline at end of file