I looked up float variables and i didnt understand at all can i use it to represent numbers? and how would i use it?
I've never been able to float. They told me in swimming class that I wasn't calm enough. I'm pretty heavy for my size, so I think it might actually be a bone density thing (I've never had a fracture), which will be helpful as I age. Seriously though, go read or watch any tutorial. Come back with questions if you need to.
There's two ways to store numbers, using an int and using a float. Both of them are just numbers, 5, 7, 6.5, 4... but the difference in between them is that an int is a whole number, 5, 3, 4, 8... but a float is a number that can hold a decimal, 5.3495, 5.0, 53.7... They both have different uses, if you have trouble deciding which one to use, use a float by default.
Wikipedia has good information on the subject: http://en.wikipedia.org/wiki/Floating_point http://en.wikipedia.org/wiki/Integer Good example on were to use int is counters or as an index for example. Float should (almost) always be used when doing mathematical calculations and that kind of stuff. Edit: Removed a faulty statement ; )
I have written a small and simple math example using an int, a short, and float expression's giving a float result. this should give you some understanding of how they can be used. Code (csharp): using System; class MixedTypes { public static void Main() { int x = 3; float y = 4.5f; short z = 5; Console.WriteLine("The result is {0}", x*y/z); } } and yes the answer is 2.7 if you try this feel free to do so if you need any more help wth this feel free to ask ok edited part : a float will hold decimal places ie. 1.3245