Skip to content

cotrFuncAnon

Creates an anonymous function

Aliases:

  • cotrFuncAnon
  • anonFunc
  • anonymous
  • closure
  • lambda
  • functionLiteral
  • cotrFuncLambda
  • cotrFuncArrow

csharp

(parameters) => {
// Your code here
};

dart

(parameters) {
// Your code here
}

go

var myFunc = func(parameters) returnType {
// Your code here
return value
}
// Usage
myFunc(arguments)

java

new InterfaceName() {
@Override
public returnType methodName(parameters) {
// Your code here
}
}

javascript

function(parameters) {
// Your code here
};

javascriptreact

function(parameters) {
// Your code here
};

kotlin

fun(parameters): ReturnType {
// Your code here
}

perl

lambda { |parameters|
# Your code here
}

php

myFunction = function(parameters) {
// Your code here
};

powershell

Terminal window
{
param(parameters)
# Your code here
}

ruby

lambda { |parameters|
# Your code here
}

rust

|parameters| -> ReturnType {
// Your code here
}

shellscript

Terminal window
# Bash doesn't have true anonymous functions, but you can use function expressions:
myFunction() { // Your code here }

swift

{ (parameters) -> ReturnType in
// Your code here
}

typescript

(parameters): void => {
// Your code here
};

typescriptreact

(parameters): void => {
// Your code here
};