home > 比較編 > F#, Scala, Haskell > functions and scope >

ForNext

Only Do What Only You Can Do

093. named parameter default value

VBScript

JScript

Perl

PHP

Python

Ruby

PowerShell

Scala

scala 2.8:
def logarithm( x: Double, base: Double = math.exp(1)) = math.log(x) / math.log(base)
logarithm(2.718)
logarithm(10, base=2)

F#

OCaml

let logarithm ?(base = (exp 1.0)) x = log x /. (log base);;
logarithm 2.718;;
logarithm ~base: 2.0 10.0;;

Haskell

none



C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

inserted by FC2 system