This guide will go through C# in the context of its use in Space Engineers. It is meant for beginners, so there may be concepts here that are not used as often in professional C# code, since those are more advanced topics. This guide also assumes you have read my first guide prior to this. If you haven't, please do so. As in my prior guide, bold words in the text (not the titles) are found in the glossary at the end of the post. Variables Variables are the bread and butter of programming. They let you store information in your program to be referenced or changed later on. Variables in C# are typed variables. This means that each variable has a specific data type assigned to it. The following types of variables (not objects) are available in Space Engineers: NOTE: This only shows types that are implemented in-game. If they don't work in-game, I'm not listing them here. I have also tested the limits, and they are accurate. int - a 32 bit integer number. This stores whole numbers (no decimal places!) between –2,147,483,648 and 2,147,483,647. (this gives you a range of 4.2 BILLION. You probably shouldn't need that much.) An int is declared as such: Code: int i = 42; int j = -246938494; short - The int type's little brother. It is a 16 bit integer. It stores whole numbers, only the range is much smaller: -32,768 to 32,767. Code: short s = 1; short t = -12941; long - The int type's big brother. It is a 64 bit integer. It ranges from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. So, very large. You most likely won't need to use a long, but I'm keeping it here to be thorough. Code: long l = -1232142145535498495356; long m = 10; uint - This is an unsigned 32-bit integer. It goes from 0 to 4,294,967,295. Code: uint u = 1; uint v = 257568258; ulong - This is an unsigned 64-bit integer. It goes from 0 to 18,446,744,073,709,551,615 Code: ulong u = 1; ulong v = 255585755784815857; ushort - This is an unsigned 16 bit integer. It goes from 0 to 65,535. Code: [/COLOR] ushort u = 1; ushort v = 10234; float - a FLOATing point number (float? Floating point? Get it? Good.) Basically, a data type that has a decimal. Floats have a range of -3.4x10^38 to 3.4x10^38. For those unused to scientific notation: 3,400,000,000,000,000,000,000,000,000,000,000,000,000 or 3.4 Undecillion. That's a lot. It also has a precision of 7 decimal places. That means it can be: 1.1234567 but won't care past that (1.12345678 would be truncated to 1.1234567.) Floats must be defined by having an f or an F at the end of the number (it doesn't matter which case): Code: float f = 1.0f; float g = 2.445562F; double - The float's cool older brother. A double can contain 1.7x10^308. (I will not write this out. I will also not do research for the name of that insane number. It's tons, you'll never need it all unless you are a masochist.) A double is also precise to 15 decimal places. It can be defined in a couple of ways: Code: double d = 1.0; double e = 1D; double f = 1d; double g = 1.0E+2; What's with the E+2? Scientific notation. Yes, you can declare scientific notation on a double. Probably won't need to, though. bool - Boolean, which is binary variable. It is either true or false. No grey areas, here. Except for this one, but that's not the boolean's fault. Code: bool thisIsTrue = true; bool thisIsFalse = false; char - This is the (very) little brother of the string. It contains a single character. A character is a letter, number, or symbol. When declaring a character, you must contain that character in single quotes (aka, the apostrophe)('). Code: char c = 'c'; char d = '!'; string - Text. Lots and lots of text. <em style="line-height: 18px;">Technically</em> a string is an array of characters, but it'll be easier to consider it to be its own thing. This entire post can be contained in a string. The URL at the top of the browser is a string. Your username is a string. Your password is a string. <em style="line-height: 18px;">War and Peace</em> is a really, really huge string. A string can hold 2,147,483,648 characters. Most people won't be holding two billion characters in a string. Also, I don't think the names in Space Engineers are capable of being able to display something 2 billion characters long, so there's <em style="line-height: 18px;">that</em>. Strings' values must be contained in double quotes ("). Do not use two apostrophes ('') or the system will smack you on the nose and say "NO!" Code: sting s = "[COLOR= #2a2a2a]A string can hold 2,147,483,648 characters. Most people won't be holding two billion characters in a string.[/COLOR][COLOR= #2a2a2a]"; string t = "Here's another string. Further examples seem unnecessary."; var - Ok, this is a funny one. You may have seen people declaring all of their variables as var in code examples: this is because it is a context-sensitive type. What does this mean? If you declare a variable as a var, it takes the type of the value you assign it to when it is declared. In programmer-speak, all the other types discussed are explicitly typed. Var is implicitly typed. So: Code: var i = 1; /*this is an int.*/ var f = 1.0f; /*this is a float.*/ var d = 1.0; /*this is a double*/ var s = "Hi there!" /*This is a string.*/ var u = 2147483648; /*This is an unsigned integer*/ var c = 'c'; /*this is a char*/ enum - Enumeration! I'd explain this, but as of 1.063.004, this crashes to desktop. Do not use. Operators Operators, shockingly, allow you to perform operations on data. You will be using some operators a lot more than others. Make sure you know how operators work, since this is just as important as variables-- you probably want to do stuff with all that data you're storing, right? This is not an exhaustive list of operators in C#. This is a list of operators you will most likely be using while working in Space Engineers.  - The square brackets are used in a lot of places. Usually this is in reference to arrays. They can also be used in other advanced operations, but that is not a lesson we are teaching today. Code: int i = new int; creates an array of 100 integers. Code: string s = "Hi, there!"; char c = s; Using , we can access the "index" of the string. In this example, variable "c" contains a comma. Don't forget that computers start counting at zero, not one. () - Used for casting one variable type to another. This will be explained at length later, in the Casting subsection. + - Adds things. Just like you learned in school! Also, concatenates strings. Code: int i = 1; int j = 2; int k = i+j; /*k = 3!*/ int l = i+3; /*l = 4*/ string s = "Hello"; string t = ", Galaxy!"; string u = s+t+" I'm Textor!";/*"Hello, Galaxy! I'm Textor!"*/ - - Subtracts, just like on the tin! Code: int i = 1; int j = 2; int k = i-j;/*k = -1!*/ int l = i - 5 /*l = -4*/ * - multiplies. Also used for other, way more advanced things, so let's stick to multiplication. Code: int i = 2; int j = 3; int k = i*j; /*k = 6*/ int l = i * 5; /*l = 10*/ / - Divides. NOTE: Two integers being divided becomes an integer! That means if you do 1/3 you'll get 0. If you use a float, it'll give you 0.3333333. Note that you will need to cast the divisor into a float in order to get a float answer, not just have the variable storing the answer be a float. Code: int i = 2; int j = 4; int k = j/i; /*k = 2*/ int l = i/2; /*l = 1*/ int m = i/j; /*m = 0*/ float n = i/(float)j; /*n = 0.5f*/ % - This is not percent. This is remainder. You know that thing you had in long division? When the numbers didn't quite add up? Yeah, that's this thing. This doesn't return 0.3333333 when you divide 1/3, it returns 1. Code: int i = 3; int j = 10; int k = j%i; /*k = 1*/ = - Assignment operator. It assigns things to other things. You probably figured this one out, already. I'm not even going to give you an example. If you need one, see every other block of code in this guide. ++<variable> - increment (increase) <variable> by 1 BEFORE using the variable. Code: int i = 0; int j = ++i; /*j = 1*/ <variable>++ - increment <variable> by 1 AFTER using the variable. Code: int i = 0; int j = i++; /*j = 0, i = 1*/ -- - The opposite of the above. Works the same, only it decrements (decreases) the variable by 1. --<variable> and <variable>-- are both present and operate the same as the ++ equivalents. += - This is an interesting one. Add a value to the variable. It's a combination of the + and = operators (as you probably can see from the fact that they are together. Code: int i = 1; i += 1; /* i = 2*/ -= - Same as above, only subtracts. *= - Same as above, only multiplies. /= - Same as above, only divides. %= - Same as above, only generates a remainder.