using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Elron_Tutoring
{
class Program
{
static void Main(string[] args)
{
// Playing with strings
string name, hello="Hello, ";
name = "Elron";
Console.WriteLine("Hello " + name); // Hello Elron
Console.WriteLine(hello + name); // Hello, Elron
Console.WriteLine(name + "Hello"); // ElronHello
// Playing with integers
int num1 = 5, num2 = 15;
num1 = num1 + 1; // Equal to num1++
num1++;
Console.WriteLine(num1); // 7
Console.WriteLine(num1+num2); // 22
// Mixing strings and integers]
string num3 = "15";
Console.WriteLine(num2 + name); // 15Elron
Console.WriteLine(num2 + num3); // 1515
// Playing with doubles
double num4 = 15.1;
num1 = (int) num4;
Console.WriteLine(num4); // 15.1
Console.WriteLine(num1); // 15
num1 = 5;
num4 = num1;
Console.WriteLine(num4); // 5
// מוסכמות כתיבה
// Is raining
// isRaining
// Elron's House
// elronsHouse
// Eating the icecream
// eatingTheIcecream
// This is the name for the box
// thisIsTheNameForTheBox
// this != THIS
int Num4 = 50;
Console.WriteLine(Num4); // 50
Console.WriteLine(num4); // 5
// Playing with bools and if/else
bool isRaining = true; // Or false
Console.WriteLine(isRaining == false); // False
Console.WriteLine(isRaining != false); // True
bool b1 = true, b2 = false;
Console.WriteLine(b1 && !b2); // True
Console.WriteLine(!b1 && b2); // False
Console.WriteLine(b1 || b2); // True
Console.WriteLine(b1 || !b2); // True
// T
// F F
// F F F F
Console.WriteLine( (!b1 && b2) == (b2 != !b1) ); // True
if (isRaining)
Console.WriteLine("Inside the if");
Console.WriteLine("Outside the if");
int num5 = 10;
string str1 = "10";
if (num5 + "" == str1)
{
Console.WriteLine("a");
}
else if (num5 + 1 == 10) {
Console.WriteLine("a");
}
else if (num5 + 1 == 11)
{
Console.WriteLine("a");
}
else
{
Console.WriteLine("Failed");
}
Console.WriteLine("Again outside");
// Playing with chars
char c1 = '1', c2 = 'a', c3 = 'A';
}
}
}
Comments