PocketPixie
PocketPixie
CC#
Created by PocketPixie on 11/27/2023 in #help
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
15 replies