This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with recursion  RSS feed

 
R Dom
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a following code.

The code is to replace the brackets from the formula.



I am trying to call processBrackets method recursively. But I am having problems.
There is some problem in the if loop at the end.
Can anyone help me to make this code correct. The problem is with the call stack.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

You'll have to explain more what you mean with "There is some problem". What is the problem? What output do you get that you don't expect? What input are you using?
I tested and it works as it has been coded...
What is it that you are trying to achieve that it doesn't do?

Sean
 
R Dom
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out what was going wrong . Thanks for the reply.
Cheers

 
Campbell Ritchie
Marshal
Posts: 55672
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . well done, but what was wrong. It would help other readers if yo utell them.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!