I’m trying to write a modular script, with functions
-Function 1 age = input(“tell me your age : “)
-Function 2 weight = input(“tell me your weight : “)
-Function 3 birthday = input(“tell me your birthday : “)
at the end, i want to send a mail outside functions like :
mail_body = age + weight + birthday
Thanks you for your time !
Advertisement
Answer
you could either use the return command at the end of function to deliver the information to where it is called
JavaScript
x
3
1
mail_body = age + weight + birthday
2
return mail_body
3
for example if your function is mailinfo() then you can process the info like
JavaScript
1
2
1
mail_body = mailinfo() #after using return command in function
2
Or you can declare mail_body as a global function at the start of program
JavaScript
1
3
1
mail_body = "placeholder"
2
global mail_body
3