Tyl Programming Language
▶ FUNCTION RETURN STATEMENT
Function return statements are used when the execution of the enclosing function needs to be stopped immediately, and a result has to be returned to the function caller.

To make a function return statement, write:
%% num
Tyl symbolizer will replace the double percent code: '%%', with: '✖✖', the function return symbol:
✖✖ num
Function return statement must be written in its own line (except for one-line statements)!

Consider this program:
main »
 max_num_result max_num 2 3
print max_num_result

max_num num1 num2 »
 num2 > num1 ? ✖✖ num2
 num1
3
max_num function gets two numbers and returns the greater of them. If num2 is greater than num1, the function return statement: %% num2, will be executed, max_num function running will stop, and num2 will be returned.
If max_num will be called with 1 as its second parameter, than the code will continue to line: num1, and that will be the returned value of the function.

Generally, function return statement is used to return values before function end.

This is a key-value-mapping (hashmap) implementation:
main :
 city_code 4524
 city city_map city_code
 city ? print 'selected city: (' + city_code + ') ' + city

city_map key :
 key 1491 ? %% 'Tokyo'
 key 2502 ? %% 'Timboktu'
 key 3513 ? %% 'Tallahassee'
 key 4524 ? %% 'Thule'
selected city: (4524) Thule
city_map is a mapping function, that returns a value for key. It is composed of conditional statements with function return statement as their yes block.

The returned statement can be any statement. Consider this:
main:
 num 20
 i 4 ~ print add_by_step (num -- 4) 10

add_by_step num step:
 num > step ? %% add_two num
add_one num

add_one num: num + 1
add_two num: num + 2
18
14
9
5
add_by_step function is returning a function operation on num, based on step parameter. In the looping: 'i 4 ~', num variable of main function is decremented, using the double minus operator: '--', and is fed to add_by_step along with a fixed step: 10.
Thus, as long as num is greater then step, add_by_step returns add_two of num, otherwise, add_one of num.