Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python default arguments

def my_function(name, age = 20):
  print(name + " is " + str(age) + " years old"

my_function("Mitro") # Mitro is 20 years old
my_function("Mitro", 26) #Mitro is 26 years old
 
PREVIOUS NEXT
Tagged: #python #default #arguments
ADD COMMENT
Topic
Name
8+9 =