default value

Scala immutable Map class: methods, examples, and syntax

This page contains a large collection of examples of how to use the Scala Map class. There are currently well over 100 examples.

A Scala Map is a collection of unique keys and their associated values (i.e., a collection of key/value pairs), similar to a Java Map, Ruby Hash, or Python dictionary.

How to define a default value for a method parameter that is a function

I was just reminded that functions are values just like Int, String, etc. Beyond the “typical” use cases, this is also true when it comes to supplying a default value for a function parameter that you’re passing into a method.

As some quick background, as I showed in the Scala Cookbook, you can define a method that provides default values for one or more of its parameters like this:

Drupal form textfield default value syntax

Drupal form textfield FAQ: How do I set the default value for a textfield in a Drupal form?

Just use the Drupal form "#default_value" tag, like this:

$form['first_name'] = array(
  '#title' => t('First Name'),
  '#type' => 'textfield',
  '#default_value' => 'John',
);

Here's an example of setting the default value of a Drupal textfield to a variable instead of a static text string: