• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stuck with stubborn return values - please give hints

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
straws are for suckers. tiny ads are for attractive people.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic