Update 'Return Direction'
parent
b0a18bcb2c
commit
b3b51ffc25
19
Return-Direction.md
Normal file
19
Return-Direction.md
Normal file
@ -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.
|
Reference in New Issue
Block a user