Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
when I try to use TryParse I get error CS0029, pls see below:
static void Main(string[] args)
{
double m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12;
double notval = 0;
Console.WriteLine("Please insert the rainfall in January:");
m1 = double.TryParse(Console.ReadLine(), out notval) ;
I get the error "Cannot implicitly convert type 'bool' to 'double'" (CS0029).
TryParse returns of it was successful at parsing or not, and puts the result (if successful) in the out parameter (on you case notval).. so use:
if(double.TryParse(Console.ReadLine(), out notval))
{
// Do what you want with notval
}
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
heres the error Argument 2: cannot convert from 'method group' to 'float'
heres the code
public Transform[] Spawns;
Random.Range(1, Spawns.GetLength);
Array.GetLength is the name of a method, meaning you need to supply a list of arguments enclosed in () to invoke it:
Random.Range(1, Spawns.GetLength(0));
That being said, the more idiomatic solution for assessing the length of a 1-deminsional array in C# would be to just use the Length property:
Random.Range(1, Spawns.Length);
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
int age;
string name;
Console.WriteLine ("Hello!");
Console.WriteLine ("What is your name?");
name = Console.ReadLine();
if (name = Max H); // **error is here**
{
Console.WriteLine ("Psst you're a nerd lmao");
}
else{
Console.WriteLine ("Hello, " + name );
}
Basically I want it so if there's a specific answer it'll give a different reply to the default answer.
main.cs(13,16): error CS0103: The name 'Max H' does not exist in the
current context =
The error I get.
TwoThree errors:
Comparing needs a double =, so ==
That "Max H" is a string constant, so must be in double quotes.
After the if, you don't want a ; as that ends the if. The next line will be executed always, except that the compiler will trip over that else (thanks RetiredNinja)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
private int skor 0;
it says "syntax error "," expected" and i cant figure out why i am very new at unity sorry if it has a very obvious answer.
You are missing assignment operator = in your skor declaration:
private int skor = 0;
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I am trying to check to see if this object contains any letters besides Z and if it does it should return Null. The way I have it initialized gives me no errors but when testing it does not actually return null if a letter is present.
if(request.DoorTag.Contains(#"[a - yA - Y]"))
{
return null;
}
if(Regex.IsMatch(request.DoorTag, "[a-yA-Y]")
{
return null;
}
But "[^zZ]" would even be better, since it'll check that your DoorTag contains any other char than Z
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
What kind of identifier does the visual studio needs ? i just want to put from outside one int array with 2 different numbers between 0 and 66.
public static void playerLocationChange(int[])
{
}
You have to give the parameter a name. Otherwise, you have no way of referring to it from the function.
public static void playerLocationChange(int[] myIntArrayParam)
//Notice the name next to int[]
//This is the parameter's name
{
}