Ad
  • Custom User Avatar

    Here's a basic template:

    using System;
    using System.Collections.Generic;
    
    public static class Kata {
      public static IEnumerable<string> FriendOrFoe (string[] names) {
        Console.WriteLine( string.Join(", ", names) );
        return names;  
      }
    }
    
  • Default User Avatar

    such a simple task However I still have a cannot convert type void error.

  • Default User Avatar

    this is what I have tried in many cases. This is why I have been confussed. I have not tried to return just names. Without the log. I will try this out.

    thank you

  • Custom User Avatar
    Console.WriteLine(names);
    

    Should do the trick. But make sure to return something that the function expects (you could just "return names" to avoid errors).

  • Default User Avatar

    Ok let me have another look. Thank you

  • Custom User Avatar

    You should use it inside the method, and you don't need brackets around "names".

  • Custom User Avatar

    See if this article helps. You can also visit Codewars Discord and ask any questions you have in #beginners, or in #help-solve channels.

    Console.WriteLine is fully operational on Codewars, and it should work if used correctly.

  • Default User Avatar

    I am a novice at coding. I am trying to work out what the array is called to right some code around it.

    Since the first element is String. I am going to assume it is names?

    I cannot for the life of me get it to ConsoleWriteLine(names). is the console log function not operational?
    So not sure if any code I write is correct.

  • Default User Avatar

    thank you very much i understand now.

  • Default User Avatar

    The index starts at 0. I used the modulo % to add 2 to the power of 0. This = 2 and also = Even.
    no need for anything else as the remander and only have aone result. That is = 1 and is Odd.

    I suck at explaining and doing math so my appoligies in advanced for the crude explanation. However that is how I got passed this Kata.
    I also tried to explain without giving the whole thing away.

  • Custom User Avatar

    It's not 2 == 0, there is something else before it. You should try following some tutorial to get familiar with fundamentals of the language before solving katas.

  • Default User Avatar

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

  • Default User Avatar

    i will leave this here: the "" is where you write your code not some 'string' thing, i got very confused tbh.

  • Default User Avatar

    its not just you mate. LOL

  • Default User Avatar

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