Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python *args

# *args is a Variable Length Argument of type Tuple,
# which takes any number of parameters, including 0 number of arguments as well.
def variableLengthArguments(*args):
  print (sum(args))

variableLengthArguments() # Output: 0
variableLengthArguments(10) # Output: 10
variableLengthArguments(10, 20) # Output: 30
variableLengthArguments(10, 20, 30, 50, 90) # Output: 200
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
9+2 =