Browse files

Add a blurb about how to write procedures with named variables in PL/…

  • Loading branch information...
leto committed Aug 17, 2010
1 parent 9065117 commit 82a1a1f3a75eb65cb5f6872f920b315aa994c061
Showing with 10 additions and 0 deletions.
  1. +10 −0 html/plperl6.html
@@ -50,6 +50,16 @@ <h1>Rakudo Perl 6</h1>
The first line is SQL, and everything between the $$ symbols is Perl 6! This stored procedure takes a single integer N and returns the sum of the first N Fibonacci numbers.
<p> The syntax <b>$^limit</b> is called a "placeholder variable." </p>
+You can also specifically name your input arguments like this:
+CREATE OR REPLACE FUNCTION test_input_3_args(integer, integer, integer)
+RETURNS int LANGUAGE plperl6 AS $$
+($a, $b, $c) {
+ $a - $b + $c
+This stored procedure is very simple, but shows how you can directly tell PL/Perl6 the "signature" of your procedure. The signature is the ($a,$b,$c), which tells Rakudo Perl 6 that there are three named arguments. The function body (the parts between the { and the } ) simply takes the difference of the first two arguments and adds the third.

0 comments on commit 82a1a1f

Please sign in to comment.