home > 比較編 > C, C++, Objective-C, Java, C# > functions >

ForNext

Only Do What Only You Can Do

092. variable number of arguments

VBScript

JScript

Perl

PHP

Python

Ruby

PowerShell

Scala

F#

C

C++

use C; use default values or function overloading for finite number of arities







C++Builder

VC++

C#

public static string concat(params string[] args) {
  return System.String.Join("",args);
}
string s = Concat.concat("Hello", ", ", "World", "!")




Java

public static String concat(String first, String… rest) {
  StringBuilder sb = new StringBuilder(first);
  for (String arg: rest) {
    sb.append(arg);
  }
  return sb.toString();
}
String s = Concat.concat("Hello", ", ", "World", "!");

Objective-C

use C; use method overloading for finite arities







D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system