Project

General

Profile

Bug #281

Creating a Procedure with a Return Value

Added by Baptiste Pillot about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
03/01/2020
Due date:
% Done:

0%

Estimated time:
Affected version:

Description

Some examples in documentation Procedures.pdf do not work :

This one works

HELLO["aa"]

Procedure HELLO[a$]
  Print "Hello, I am a procedure ! " + a$
End Proc

But this one, with a return value, does not :

Print HELLO["one"]

Procedure HELLO[a$]
  Print a$
End Proc[a$+a$]

main.aoz:1:12: error: Syntax error


Files

3.5._Procedures.pdf (82.3 KB) 3.5._Procedures.pdf AOZ Procedures documentation. Brian Flanagan, 03/07/2020 06:33 AM
#1

Updated by David Baldwin about 4 years ago

That's because it's bad code. Should be:-
HELLO["one"]
Print Param$
Procedure HELLO[a$]
Print a$
End Proc[a$+a$]

#2

Updated by Brian Flanagan about 4 years ago

Problem still exists in 0.9.6.

No, it's not bad code. According to the AOZ documentation, The example Baptiste gave should work.
See the Procedures.pdf (attached) for details. Search for the heading " Returning values from a procedure ".

NOTE: The old method using Param, Param$, Param#, etc. is still supported as well.

#3

Updated by Francois Lionet about 4 years ago

  • Status changed from New to Resolved
  • Target version set to 0.9.8.1

Please don't fight! :) It was a bug of mine, and both syntax are correct now...

#4

Updated by Brian Flanagan over 3 years ago

  • Status changed from Resolved to Closed

Re-tested in 0.9.9.4 RC1.
It still works!

Also available in: Atom PDF