parameter

Scala - Passing a function literal as a function argument

Note: The following examples of passing a function as an argument to another function have all been taken from the PDFs on the Scala website. The only thing I've done here is to add comments to the source code, and add detailed discussions of them in this article.

Scala methods: dots, spaces, and parentheses

If you've started using Scala, you've seen that there are some cool things in the Scala syntax compared to Java. For instance, in Java you'd execute a method on an object like this:

object.method();

But in Scala you definitely don't need the semi-colon:

object.method()

and then you can omit the parentheses:

object.method

I think you'll agree that this Scala syntax contains much less "noise" than the Java syntax.

Ruby - Variable length argument lists with Ruby

Ruby FAQ: How do I create a variable length argument list in a Ruby method?

One thing I really dig about Ruby is that I can create methods and functions that support variable-length argument lists. It's not something you need all the time, but it sure is nice to have it when you need it.

Here's how you create and then call a Ruby function/method that can take a variable number of arguments:

How do I read command-line arguments with Perl?

Summary: A quick tip on how to read Perl command line arguments.

When you're writing a Perl script, command-line arguments are stored in the array named @ARGV.

$ARGV[0] contains the first argument, $ARGV[1] contains the second argument, etc.

$#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1.

Syndicate content