ADVERTISEMENT
ADVERTISEMENT

Python program to pass function as an argument

Here, we are going to learn how to pass function as an argument in Golang (Go Language)?
Submitted by Shivang Yadav, on March 18, 2021

Python allows programmers to pass functions as arguments to another function.

Such functions that can accept other functions as argument are known as higher-order functions.

Program to pass function as an argument

# Function - foo()
def foo():
    print("I am Foo")

# higher-order function - 
# koo() accepting foo as parameter 
def koo(x):
    x()

# function call with other function 
# passed as argument
koo(foo)

Output:

I am Foo

Python Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.