C
C#15mo ago
Fluffy

I ethically borrowed some source code and it doesn't work

I took some source code but when I pasted it, it started blaring errors and I'm not too sure what the errors mean.
10 Replies
Fluffy
FluffyOP15mo ago
It's in Unity
Fluffy
FluffyOP15mo ago
The original function was this:
public static float Min(params float[] values)
{
int num = values.Length;
if (num == 0)
{
return 0f;
}

float num2 = values[0];
for (int i = 1; i < num; i++)
{
if (values[i] < num2)
{
num2 = values[i];
}
}

return num2;
}
public static float Min(params float[] values)
{
int num = values.Length;
if (num == 0)
{
return 0f;
}

float num2 = values[0];
for (int i = 1; i < num; i++)
{
if (values[i] < num2)
{
num2 = values[i];
}
}

return num2;
}
Pobiega
Pobiega15mo ago
look at the error messages you are getting
Angius
Angius15mo ago
Well, what are the errors?
Fluffy
FluffyOP15mo ago
Im trying to get them but my screenshot program is breaking on me
Pobiega
Pobiega15mo ago
you can read them yourself, thats fine
Fluffy
FluffyOP15mo ago
Top Level statements must precede namespace and type declarations
Pobiega
Pobiega15mo ago
you can't just randomly paste code anywhere in a file and expect it to work Im guessing you pasted this outside a class
Fluffy
FluffyOP15mo ago
ah shoot I think i did Yeah that was a dumb mistake It really looked like it was in the class Ty for the help
Angius
Angius15mo ago
Code goes into methods, methods into classes, classes into namespaces Yeah
Want results from more Discord servers?
Add your server