Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stuck with stubborn return values - please give hints

 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My main method calls a method no1, which is calling a method no2 three times in a row.
Now I wish that method2 would return either value x or value y
(depending on some if-else results) to method1, so that method1 continues calling
method no2 with that newly changed value.
But method no1 stubbornly calculates in all three calls with the value it got from the
main method no matter what the return value was from method no2.
My question: how can I "convince" method no1 to accept the return value of method no2
and forget about the given value in the main method?
thank you for your patience of answering this (probably very green) question..

juliane
 
Ronald Schindler
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Juliane,
without seeing code its a little hard to make a definite determination. But it sounds as if you have the variable being set with the first method each time it is called. You might want to try looking at the scope of the variable within the first method.
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saving the value that was returned? Did you assign it to an identifier?
 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for bothering, Ronald and Marilyn!
I had my program running 2 minutes after your
hints, thank you!! (and even smaller )
Juliane
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic