Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
return in a function
#5
(Mar-06-2021, 05:13 AM)michael1789 Wrote: Python dictionary.
dict = {'alex' : 1,
        'larry' : 2, 
        'mark' : 3}

print(dict['mark'])

the example i gave involves testing various different variables. maybe it's a bad example. the "bunch of code" can't be changed. the question is about how to have function A call function B and have function B effect the return all the way to the caller of function A. put the "bunch of code" inside function B so function A can just call function B in all those places it had that "bunch of code". but what about those returns? can function B do a return for function A? not really. see the complication?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
return in a function - by Skaperen - Mar-06-2021, 02:58 AM
RE: return in a function - by michael1789 - Mar-06-2021, 05:13 AM
RE: return in a function - by Skaperen - Mar-06-2021, 08:25 PM
RE: return in a function - by snippsat - Mar-06-2021, 01:04 PM
RE: return in a function - by ndc85430 - Mar-06-2021, 01:47 PM
RE: return in a function - by Gribouillis - Mar-07-2021, 09:22 AM
RE: return in a function - by Skaperen - Mar-07-2021, 09:03 PM
RE: return in a function - by Gribouillis - Mar-08-2021, 07:43 AM
RE: return in a function - by Skaperen - Mar-08-2021, 08:18 AM
RE: return in a function - by nilamo - Mar-11-2021, 07:57 PM
RE: return in a function - by Skaperen - Mar-14-2021, 01:39 AM
RE: return in a function - by ndc85430 - Mar-14-2021, 07:14 AM
RE: return in a function - by Skaperen - Mar-15-2021, 01:31 AM
RE: return in a function - by nilamo - Mar-15-2021, 04:55 PM
RE: return in a function - by ndc85430 - Mar-15-2021, 06:33 AM
RE: return in a function - by Serafim - Mar-15-2021, 11:00 AM
RE: return in a function - by Skaperen - Mar-16-2021, 07:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is that possible to have a new feature: dynamic return with using function argument kouui 2 2,085 Aug-26-2019, 10:05 AM
Last Post: kouui

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020