Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Yup, that's an errr, but what is your problem?

  • This comment is hidden because it contains spoiler information about the solution

  • I believe this fails for index == len(items), the conditional is true so it'll try to look it up but the index is out of bounds.

  • In Java the code has a couple of issues:
    -Line 1 reads: "public static class AgeDiff" but it should be "public class AgeDiff " (without static).
    -Line 3 reads: "public static string CalculateAge(int birth, int yearTo)" but it should be "public static String CalculateAge(int birth, int yearTo)" (with capital "S" in "String").

  • Hi MercerFrey - Which language is this on?

  • Thank you (GrahamD) for raising this issue and thank you (JetFly) for providing these example test cases.

    I've added them to the kata, with the addition of a couple that require the user to return "1 year".

  • Reopening dinglemouse's issue:

    The Java version needs a bit of a cleanup

    static class
    

    public static class AgeDiff {
    java.lang.RuntimeException: /AgeDiff.java:1: error: modifier static not allowed here
    public static class AgeDiff {

    string --> String
    

    public static string CalculateAge(int birth, int yearTo) {
    ^
    symbol: class string

    Also the method CalculateAge should be renamed to calculateAge
    
  • All sample tests passed, but im still getting "There was an issue submitting your final solution" error (Java version of Kata).

  • C# version test results after attempt
    Expected: "You are 4years old."
    But was: "You are 4 years old."
    Are you serious? No space?

  • Golang translation created, please review!

  • Troche zgubilem sie przy you are iles tam years old...ale w koncu kata zaliczona.

  • Fajne zadanko - w zwiozku z trescio zadania male pytanko - w jakim miescie mieszkasz w UK?

  • Java:
    class AgeDiff should not have 'static' modifier.
    In Java method names should start with lowercase letters.
    String is a class and should start with a capital 'S'.
    Also, method is declared static, but in tests is accessed using AgeDiff instance. It's weird, so method should not be static also.
    Now: public static string CalculateAge(int birth, int yearTo)
    Should be: public String calculateAge(int birth, int yearTo)

  • Impossible in C#
    My tests
    Assert.AreEqual("You are 17 year(s) old.", AgeDiff.CalculateAge(2003, 2020));
    Assert.AreEqual("You were born this very year!", AgeDiff.CalculateAge(2003, 2003));
    Assert.AreEqual("You will be born in 17 year(s).", AgeDiff.CalculateAge(2020, 2003));

    says that all are okay
    but wtf, random tests delete my "(" and ")"

  • Assert.AreEqual("You are 17 year(s) old.", AgeDiff.CalculateAge(2003, 2020));
    Assert.AreEqual("You were born this very year!", AgeDiff.CalculateAge(2003, 2003));
    Assert.AreEqual("You will be born in 17 year(s).", AgeDiff.CalculateAge(2020, 2003));

    //Remade, try this.

  • Loading more items...