home > 比較編 > Perl, PHP, Python, Ruby > functions >

ForNext

Only Do What Only You Can Do

154. decorator

VBScript

JScript

Perl

PHP

Python

def logcall(f):
  def wrapper(*a, **opts):
    print('calling ' + f.__name__)
    f(*a, **opts)
    print('called ' + f.__name__)
  return wrapper

@logcall
def square(x):
  return x * x

square(5)

Ruby

PowerShell

Scala

F#

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system