- Home /
C# Variable
Does anyone know how to declare a variable in c#. I want to do this: This is java script - var levelname:String; Thanks
No I didn't. I used the wrong search terms. Thanks anyway :D Johnny
Answer by nsxdavid · Feb 25, 2013 at 10:31 PM
JavaScript:
var levelName:String;
Would be in C#:
String levelName;
Answer by gouthammannuru · Oct 02, 2016 at 09:30 AM
I am trying to add a variable to hold or show values and i used this and it is not working
public static int X = 0;
I also tried
public int X;
That's not an answer to this question. If you have a new question post it as a new question. But you'll need to provide more information including what the problem actually is. If you put them in the right place then those lines will declare variables.
Answer by matthebest · Sep 18, 2015 at 12:21 AM
In c#
If you want it to be public:
public string yourString = "...";
Private:
string yourString = "...";
Answer by himanshugupta159 · Jan 22, 2019 at 06:39 AM
Written a blog related to concept of varibles and function the link is attched below: https://unfragilecoding.blogspot.com/2018/04/basicsof-programming-variables-and.html