Skip to content

Instantly share code, notes, and snippets.

@angusbarnes
Created April 30, 2018 21:43
Show Gist options
  • Save angusbarnes/a0fd06fab61c30ac267aa2112ee9944c to your computer and use it in GitHub Desktop.
Save angusbarnes/a0fd06fab61c30ac267aa2112ee9944c to your computer and use it in GitHub Desktop.
All the code from lesson 1.
using System;
class Class1
{
public static void Main ()
{
string someString = ""; //Declares a string called someString
//and sets it to nothing
int someInt = 0; //Declares an int called someInt
//and sets it to 0
float someFloat = 3.1415f; //Declares a float called someFloat
//and set it to pi
Square(3); //Calls the square function and passes it
//the int value 3
Multiply(someInt, 4); //Passes someInt and 4 into the
//Multiply function
}
static void Print(string message) //makes room for a string
{
Console.WriteLine(message); //Writes the message to the screen
}
static void Square(int number) //Makes room for an int
{
int result = number * number; //Gets the result by multiplying the
//passed int 'number' by itself
Print(result.ToString());
}
static void Multiply(int num1, int num2) //Makes room for two ints
{
int result = num1 * num2; //Gets the result by multiplying the
//num1 by num2
Print(result.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment