Questions tagged [nested-function]

Nested functions are functions whose definition is lexically enclosed inside another function definition. Nested functions are not necessarily available in every language having the concept of function, and the exact meaning of the term varies among languages.

410 questions
-1
votes
1 answer

What is the syntax for the input for a def function with multiple nested functions?

I'm learning Python right now and I am just trying to get to grips with all of the syntax options. Currently, the only thing that I can't seem to google up is what to do if I for some reason want to define a function which contains multiple other…
-1
votes
2 answers

Python: calling inner() from outer()

I have looked around on SO and surprisingly not found an answer to this question. I assume this is because normally inner/nested functions are used for something in particular (eg. maintaining an environment variable, factories) as opposed to…
NotAnAmbiTurner
  • 2,553
  • 2
  • 21
  • 44
-1
votes
1 answer

In python, how to call a function C nested under another function B inside a class A from outside of the class

In python, how to call a function C nested under another function B inside a class A from outside of the class. >>> class A: ... def funcB(self): ... print('inside funcB') ... def funcC(self): ... print('hello world') ... >>>…
-1
votes
3 answers

calling a function inside another function(nested)

I have a function in Python def outer_function(): def inner_funtion(): print ('inner message') print('outer message') sys.exit() How do I call the inner function? I'm quite new to the inspect library and with closure if this…
Dart Feld
  • 21
  • 4
-1
votes
1 answer

calculating distance between values in vector R

I have the following multiset X, in which I want to find the distances between all the numbers. Is there any way to integrate this into a FOR LOOP so that If I was given a different sized multiset, I wouldn't have to manually do it like i did…
Gabriel
  • 405
  • 1
  • 6
  • 16
-1
votes
2 answers

Undefined reference to function in C program

I'm kind of new in C programming. To be honest this is my first program where I am using Function. But it's not working. Can anyone tell me what is supposed to be the problem? // Convert freezing and boiling point of water into Fahrenheit and…
-1
votes
1 answer

Python call inner function inside another function

Edited! I wanted to reference inner function return value outside of outer function, and actually inside of another function. Example: def m1(): def m2(): x= 'A' y= 'B' pre_solution = x+y return pre_solution …
-1
votes
3 answers

Call a function with arguments from two diffrent functions

I need help with the layout of some code. Can I somehow call function3 with an argument from both function1 and function2? I can't make function2 to be a nested function since it is activated by a onclick. Thank you! function 1(){ //This function…
WilliamG
  • 451
  • 1
  • 8
  • 16
-1
votes
2 answers

I am learning javascript and i'm stuck with the concept of function returning function

please help me with below code.I did not understand the functioning of return function(object1,object2).How does the return function in create comparison function() get its parameters.? var data = [{ name: "Zachary", age: 28}, {name: "Nicholas",…
-1
votes
3 answers

I keep getting this error: pointer value used where a floating point value was expected

I already saw a question about it, more than one, but it did not really solve my problem. The code is bigger, but the problem is with this part. I have this thing: int globalx=12; int globaly=10; void Function (int measurex, int measurey) …
Lex
  • 1
  • 1
  • 2
-1
votes
1 answer

Return from nested function

I am trying to figure out how to return a value from inside a nested function to its parent function. The code that I am working with is: func findObjectsInBackgroundFromLocalDataStoreIfPossible (query: PFQuery, toCallUponCompletion: () -> ()) ->…
Acoop
  • 2,586
  • 2
  • 23
  • 39
-1
votes
2 answers

Javascript Call To Nested Function

I am relatively new to javascript, but have learned alot about OO programming from using Java. Either javascript is not very OO or I am missing something. Java has classes with methods much like javascripts functions, but I noticed that javascript…
StoneAgeCoder
  • 923
  • 1
  • 7
  • 13
-1
votes
1 answer

retrieve names of closures declared inside function

if we have : function parent(){ function a(){ return 'i am a'; } function b(){ return 'i am b'; } function c(e,f){ console.log(e+f); } c(a(),b()); } Any built-in method that retrieves name of nested functions: a,b,c…
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
-1
votes
5 answers

Formatting of a JavaScript function.function()

I have a set of functions that manage CRUD operations on a database. I am trying to have a top level function that houses the add, update, delete, etc. functions to keep it clean and organized. I often see Javascript SDKs that look like…
Rob
  • 11,185
  • 10
  • 36
  • 54
-1
votes
4 answers

Nested function weirdness on PHP

Possible Duplicate: nested functions in php throws an exception when the outer is called more than once why does function foo(){ function bar(){ } } bar(); return fatal error on nonexistent function bar while function foo(){ …
Jonathan DS
  • 2,050
  • 5
  • 25
  • 48
1 2 3
27
28