How this thing works at all | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
28th Oct 2019, 2:45 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar
3 Answers
+ 1
When you call the foo function, it returns(calls) bar function with b++ as argument. Here b=5 and therefore a parametrr inside bar fumction is 5. Now in bar function b is incremented by one i.e. is 6(because it's post incremented). So we have b+a= 6+5 =11.
28th Oct 2019, 3:25 PM
Qasem
+ 1
Vladislav Semeniuk 🐸 in last line of code you call function foo.inside of foo the first executable line is return bar (b++). After that bar function is executed. "functions never run before you call them"
28th Oct 2019, 3:38 PM
Qasem
0
Qasem why return bar(b++) executes before function bar?
28th Oct 2019, 3:34 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar