How to write function in .net6? [Answered]
I try .net6 for the first time and i got an error ask me to provide return value regardless that i already provided one.
8 Replies
That only returns if the condition in the if statement is true. You need a return regardless of conditions.
like this ? but error still there
No, because now the for loop will only run ones.
there is no guarantee that the code will enter the for loop
You need to add a return at the very end where it is not based on any conditions or anything. Sort of like fallback if everything else fails/doesn't run at least that will return.
sound like something in C
also,
.IndexOf
exists :)
✅ This post has been marked as answered!