Ad
  • Custom User Avatar

    I thought it would be an issue if codewars did something the language's native environment did not do, which is why I flagged it. Restating the solution I posted 5 months ago and not addressing the difference I pointed out between the environments makes it seem like we are discussing different things. I am not asking for assistance with a solution, I am pointing out that codewars added a leading space to an unitilized variable where powershell ise did not.

  • Custom User Avatar

    What i mean is that I do not know exactly, but I really doubt that it's an issue with runner or Codewars environment. If it were Codewars fault, then the space would be added always, and not only when the variable is uninitlized, right? I was able to fix your solution just by adding three characters to it. I added = "" and it worked.
    Having to choose between some mysterious bug in Codewars and an error caused by an uninitialized variable, I'd bet on the latter, or maybe some other thing I dont understand yet, like some syntax clash or something.

    I checked some other solutions, and checked reference solution and checked your solution after my change, all of them work. Currently the only problem is with your solution, which contains some suspicious syntactic construct i dont exactly understand (because I'm too noob with Powershell), but seems to be a culprit and cause of your problems.

  • Custom User Avatar

    That is explained in my response from 5 months ago, and the issue is the space is added in codewars but not in powershell ise as shown in the image in the same response?

  • Custom User Avatar

    Your solution works for me if I replace line 5 with following:

    $bestWord = ''

    I do not know PowerShell too well so I do not know whether it's a problem with your solution and some kind of uninitialized variable, or with Codewars setup.

  • Custom User Avatar

    Do these replies actually notify anyone?

  • Custom User Avatar

    Not sure what your code is, but Xormias is saying that the kata requires you to build a return statement within the function as opposed to printing out the result to the terminal. Additionally many challenges may actually fail if you leave print statements in them due to the way they are built to be checked.

  • Custom User Avatar

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

  • Custom User Avatar

    Spaces don't appear out of nowhere, and compilers on CW aren't special either. Based on that, you'll have to make conclusions on your own.

    I'd classify that as programmer's mistake, but that's just me. Of course, if you were able to reproduce this: by showing the input, your output, expected output, and the reason it's wrong - then it could become an actual issue. Given that powershell isn't that that popular, it's certainly possible, but there has to be proof and not just words.

  • Default User Avatar

    Are issues only kata specific? I guess this is more towards codewars in general? If the the in-browser ide acts differently compared to a desktop ide...like adding spaces to a return value that was not added when compiled in vscode, what would that be classified as?

  • Custom User Avatar

    Your code not doing what you expect is not a kata issue. Please read this: https://docs.codewars.com/training/troubleshooting/

  • Default User Avatar

    I appreciate the response, but just to be clear...youre saying do not use the "/" in repition? Or Dont use the "/" to divide?

  • Default User Avatar

    Avoid this kind of operations: a/b/c when possible.

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    I am having a slight issue, I am using powershell and I have a working function but when I test it in the browser it is adding a leading space. The space doesnt appear when I test it outside the browser, and I verified by checking the length of the return string, I also tried adding trims in a few different places just to force it but it isnt catching it.