Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
learning
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here /* Console.WriteLine("Hello, world!"); int a = 21; string firstname = "Anika"; object e = 11; object b = "hi guys"; // object to store universal types. int x = 12345; Console.WriteLine(Math.Sqrt(x)); int age = 22; Console.WriteLine("My age is " +age+ " and in 10 years it will be " +(age+10)); */ /* Random a = new Random (); { int number = a.Next (1, 100); int number1 = a.Next (1, 100); bool Isgreater = (number > number1); if (number > number1) { Console.WriteLine(" Number A " + number + " Is bigger than number B " + number1 + " , " + " Is A greater than B? " + Isgreater); } if (number <number1) { Console.WriteLine(" Number B " + number1 + " Is bigger than number A " +number + " , " + " Is A greater than B? " + Isgreater); } if (number == number1) { Console.WriteLine(" Number A " + number + " Is the same as number B " +number1 + " , " + " Is A greater than B? " + Isgreater); } // Nullabes are reference ypes so they reference to an object // in the dynamic memory which contains the real value so like pointers. they could have a vlue or they could have NULL. // Nullable<int> i1= null; // int? i2 = i1; }*/ // so I assign a as 5 and then in my nullable type i assign ni as I so ni points at is value. /*int a = 5; int? ni=a; Console.WriteLine(ni); Nullable <int> i1 = null; int? i2 = i1; Console.WriteLine(i2); // the top should give me nothing but I can check if a variable has a value or not by using the following: Console.WriteLine (ni.HasValue); Console.WriteLine (i2.HasValue); // then to giev the value the other way we have to do this: //i1 = i2.Value; //this will giev system.invalueoperationexception so we do something special to giev the null value a default number which is 0 cuz its easier to read. a = ni.Value; //Console.WriteLine(i1); Console.WriteLine(a); i1 = i2.GetValueOrDefault(); Console.WriteLine(i1); //Nullable types are used for storing information, which is not mandatory. For example, if we want to store data for a student such as the first name and last name as mandatory and age as not required, we can use type int? for the age variable: */ // String literals, literals are basically correct ways of displaying certain things and the correct syntax to certain things ex. // normally if we wanna write "" in a sentence it would just kinda be like couting but if u do this: string quotation = "\"Hello girl whats up\", he said"; Console.WriteLine(quotation); // and thats how it works. bool isMale = false; Console.WriteLine ("Is anika male? " +isMale); string hi = "hello";// declaireing string wo = "world"; object wow = (hi + " " + wo); Console.WriteLine(wow); // concatenating two string in one object. //initializing and declare. /*string we = "wee"; we = (string)5; string secondstring; secondstring = we; Console.WriteLine(secondstring);*/ string f; wow = (object); f = wow; } } }
run
|
edit
|
history
|
help
0
12
Pramod
Decimal separator diff
Interesting dictionary initialization syntax
ExtensionDateTime
BTC sell estimator
Prism area
Fibonacci Modified
sdfnmj,k, mnfdc
tc2_1siod_ga_tp1_benouirane_ex1