C# 用字符串打印 long int
C# print long int with string
我可以在代码的第一部分正确调用它,它内置在一长串 if else 语句中。
if (Ten < 0) {
Ten = x;
long y = System.Int64.Parse (One + "" + Two + ""//... code continues);
print ("Press Tab to confirm to play with " + y + ".");
ChosenNum ();
} else if (Ten > -1) {
print ("Press Tab to confirm to play with " + y + ".");
}
在后面的代码和下面的函数中它没有调用长 y。
void ChosenNum ()
{
if (Input.GetKeyDown (KeyCode.Tab)) {
print ("You have chosen " + y);
StartGame2 ();
}
}
我想在函数之后和函数中的代码中调用 long y,如果我分配 long y;在 my class 的开头与我的 int y 冲突;例如,创建一个长 w 将导致需要额外的代码,但想找到一个解决方案而不这样做。
为什么不直接这样做呢:
void ChosenNum (long value)
{
if (Input.GetKeyDown (KeyCode.Tab)) {
print ("You have chosen " + value);
StartGame2 ();
}
}
然后调用它:
if (Ten < 0) {
Ten = x;
long y = System.Int64.Parse (One + "" + Two + ""//... code continues);
print ("Press Tab to confirm to play with " + y + ".");
ChosenNum (y);//pass it here, this is my change
} else if (Ten > -1) {
print ("Press Tab to confirm to play with " + y + ".");
}
我可以在代码的第一部分正确调用它,它内置在一长串 if else 语句中。
if (Ten < 0) {
Ten = x;
long y = System.Int64.Parse (One + "" + Two + ""//... code continues);
print ("Press Tab to confirm to play with " + y + ".");
ChosenNum ();
} else if (Ten > -1) {
print ("Press Tab to confirm to play with " + y + ".");
}
在后面的代码和下面的函数中它没有调用长 y。
void ChosenNum ()
{
if (Input.GetKeyDown (KeyCode.Tab)) {
print ("You have chosen " + y);
StartGame2 ();
}
}
我想在函数之后和函数中的代码中调用 long y,如果我分配 long y;在 my class 的开头与我的 int y 冲突;例如,创建一个长 w 将导致需要额外的代码,但想找到一个解决方案而不这样做。
为什么不直接这样做呢:
void ChosenNum (long value)
{
if (Input.GetKeyDown (KeyCode.Tab)) {
print ("You have chosen " + value);
StartGame2 ();
}
}
然后调用它:
if (Ten < 0) {
Ten = x;
long y = System.Int64.Parse (One + "" + Two + ""//... code continues);
print ("Press Tab to confirm to play with " + y + ".");
ChosenNum (y);//pass it here, this is my change
} else if (Ten > -1) {
print ("Press Tab to confirm to play with " + y + ".");
}