Update 'Return Direction'

Sasha Koshka 2022-08-24 05:46:20 +00:00
parent b6b985b8d5
commit b6e12bdbf1
1 changed files with 17 additions and 0 deletions

17
Return-Direction.md Normal file

@ -0,0 +1,17 @@
The way ARF handles return values from functions is different from other
languages, and is made possible by its ability to define variables in-place. It
is done using an arrow called a return direction:
`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`.
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.