this is seriously helpful i am a newbie who wants to help out mpgh community
some parts i have no idea what you are saying can you help me out... sort of like as simple as that. the string Name will get the value (or text) that you typed in the console and when Enter key is pressed.
*Now getting this into a Program (using the old eg.)
Code:
using System;
namespace ConsoleApplication1
{
public class Program
{
static void Main()
{
int a = 0;
int b = 0;
Console.WriteLine("Insert the age of the first person:");
a = Convert.ToInt32(Console.ReadLine()); //i do have here to use Convert.ToInt32() in here because he will need to convert the type string (text, etc.) into a INT, so it has a better way to compare, or do mats, w/e.
Console.WriteLine("Insert the age of the secound person:");
b = Convert.ToInt32(Console.ReadLine());
if (a > b) //this will compare 2 or more things (lets just stay with 2 for now...) it will check if a is bigger then b, and if it is, it will do:
{
Console.WriteLine("var a is Older then var b"); //since a were older (or bigger) then b, it will execute every instruction inside this { ... }
}
else //if a isnt bigger then b, then he will do this (just like our language: If i'm a boy, i will like girls, Else i will like boys.
{
no idea.... XD
Originally Posted by kobe.piercy
some parts i have no idea what you are saying can you help me out... sort of like as simple as that. the string Name will get the value (or text) that you typed in the console and when Enter key is pressed.
*Now getting this into a Program (using the old eg.)
let me see if i understand your doupt, so you don't exactly know how Console.ReadLine(); works?
Well, if you already runned the program you will realise that the program will stop at the part where you have the Readline, waiting for you to write something, and he will only "read it" when you press <Enter>, then he will read the string that you wrote into the data type string or it will convert it into a INT datatype and then save it in a INT, and then the program will continue.
I hope you did understand it now, if not feel free to post again your doupt, or pm me ^^.