© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
14 replies
PocketPixie

Help with this coding problem.

Hello all, can someone diagnois what does it mean by this code stack?
public class Solution {
    public int[] SortArrayByParityII(int[] nums) {
       int n = Convert.ToInt32(nums);
        if(n % 2 == 0)
        {
            Console.WriteLine(n);
        }
        else
        {
            Console.WriteLine(n);
        }
    }
}
public class Solution {
    public int[] SortArrayByParityII(int[] nums) {
       int n = Convert.ToInt32(nums);
        if(n % 2 == 0)
        {
            Console.WriteLine(n);
        }
        else
        {
            Console.WriteLine(n);
        }
    }
}


The problem is
Line 2: Char 18: error CS0161: 'Solution.SortArrayByParityII(int[])': not all code paths return a value (in Solution.cs)
Line 2: Char 18: error CS0161: 'Solution.SortArrayByParityII(int[])': not all code paths return a value (in Solution.cs)


I've tried converting the array in the method to an int type but that doesn't work
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Help with coding
C#CC# / help
3y ago
❔ Help with homework coding 'project' due this Thursday
C#CC# / help
3y ago
A problem with Visual Studio coding
C#CC# / help
4mo ago
Help with coding simple game
C#CC# / help
4y ago