Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

if inside for method wont work?!? why?

 
Dmitri Makovetskiy
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator






my goal is to find how many times a character repeatself in the sentence.. but it fails to trigger the if method correctly. why.?
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You if statement is working fine. In your loop you are assigning number2 to number + 1 but number is always zero so number2 is always set to 1. I think you meant
 
Dmitri Makovetskiy
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Reilly wrote:You if statement is working fine. Every time through your loop you are assigning number2 to number + 1 but number is always zero so number2 is always set to 1. I think you meant



Tom . thank you. you found my mistake, i wasnt very smart was i...xD
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic