6 kyu

For want of a symbol

Description:

Story
Pete wrote a code to print 20 stars. While he was away, John replaced one character and got this:

{ int i, N=20; for (i = 0 ; i < N ; i--) { System.out.print("*"); } }
{ var i, N=20; for (i = 0 ; i < N ; i--) { PrintStar(); } }

What was Pete initial code? You get three guesses.

Formal problem
For() should return an array of three strings. They should differ from code example above in one and only one character, they should all be different and each of them should be the correct code that outputs exactly 20 stars.

Notes and hints
-- Character should be replaced, not inserted or deleted (i.e. all strings should be of the same length as initial one).
-- Declaring elsewhere new functions which differ from one called to print star in current code by only one character (e.g. Printstar() instead of PrintStar()) is not a correct solution.

Credits
Kata based on "Checking basics of for loop" puzzle from braingames.ru: http://www.braingames.ru/?path=comments&puzzle=169 (russian, not translated).

Puzzles

More By Author:

Check out these other kata created by Absurdated

Stats:

CreatedMay 13, 2015
PublishedMay 14, 2015
Warriors Trained419
Total Skips26
Total Code Submissions829
Total Times Completed116
JavaScript Completions116
Total Stars12
% of votes with a positive feedback rating96% of 59
Total "Very Satisfied" Votes56
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes2
Total Rank Assessments17
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Absurdated Avatar
  • Voile Avatar
Ad