This is a bad suggestion as this question is aimed at functional programming with algebraic datatypes. In Rust the actual return types for this function are Result::Ok(u32) and Result::Err(String). Result is a useful monoid that makes error handling super simple when you combine it with pattern matching.
I embarrassingly had a tough time with this. I've not spent much time or had any formal math or algorithm courses. That said this is incredibly frustrating and poorly explained writ large across the internet. I feel inadquate and disgusted.
This is a really good example of a challenge that needs to be thoroughly commented. Imagine trying to work with all these different answers and figure out what is going on! Comment your code people lol
Put this as the first line of your function: echo($integer."\n"); The answer should be a string, your code is returning an array instead.
i'm sorry, maybe i'm stupid, maybe its all my bad english, but i don't understand.
i guess this error comes when the answer must be string (like "13 is prime"), but idk why it want array type in this case
Print the input, see why your code fails with that value.
This comment is hidden because it contains spoiler information about the solution
I think is not a for a. It's "return a" "for a in range()" " if something".
Isn't it quite clear that your result not sorted at all?
it explicitly says that it should return a sorted array in ascending order but when i attempt i get this message
"The array is not what was expected: expected [ 12, 2, 3, 4, 6, 8 ] to deeply equal [ 2, 3, 4, 6, 8, 12 ]"
Suggestion: If no divisors are found, return an empty array, just to keep type consistency in the returned value! ☺
Not a kata issue and please don't post solutions in Discourse.