C# programming

Cards (22)

  • A variable is a named data type that can store a value of any type.
  • 3 things to consider when naming a variable:
    -use consistent capitalisation
    -don’t start with a digit
    -Don’t include spaces
  • Incrementing increases the value of an integer by 1 using ++
  • When Declaring a variable give the variable a name and specify the type of data to be stored in the variable
  • String is used for a combination of any keyboard character that appear on a keyboard, such as letters, numbers and symbols ( eg. Pa$$w0rd)
  • Boolean variables are used to hold true or false values
  • To print out the contents of a string use Console.WriteLine("string");
  • Console.ReadLine() reads user input from the console and returns it as a string
  • A char is a single character
  • The difference between int and double is that int can only store whole numbers whereas doubles can store decimal places.
  • The if statement allows us to test whether a condition is true or not.
  • Sequence: a particular order in which related things follow each other. They’re performed on how they’re listed.
  • Selection: when we choose one thing over another based on some criteria, like an IF statement.
  • Iteration: repeating something multiple times using loops.
  • To convert from string we do int userEntry= Convert. ToInt32(userEntry)
  • Declaring a variable is the process of assigning a name to a variable.
  • Initializing a variable means giving it a value
  • Assigning a variable is the process of giving it a value. This is done using a single = sign.
  • While is a type of loop that repeats a block of code a specified number of times based on the conditions
  • The while statement executes as long as its condition remains true, so if the condition never becomes false, then the loop will continue forever.
  • For loops are used when you know exactly how many iterations you want your program to perform.
  • Else is used when a condition is not met, but the statement is still true.