![]() ‘Prompt the user to enter the second operand ValueOne = Integer.Parse(Console.ReadLine()) ‘Prompt the user to enter the first operand ‘Try…Catch: is used to catch any unexpected behavior Write statements to input two positive integers and display the sum.In order to add a 1 line comment write a single quote before your comment anything after ‘ is ignored by the compiler. As you notice, in the code below we added some comments that makes the code more comprehensible. Tip:It’s a good practice to add comments to your code.The Solution name and the project name is VBSumOf2Numbers Open Visual Studio and create a new VB Console Application.For each solution create a new Console Application. Test the application and save your work You can run the application by clicking on the Start button with the green arrowĬreate Console Applications that uses conditional and branching statements.Ĭomplete three simple programming tasks in VB.‘Prevents the program from exiting immediately when the code has ‘The name entered will be assigned to the variable “myName”Ĭonsole.WriteLine(vbCrLf + “Please Press any Key to Exit”) ‘Declare the variable “myName” of type stringĬonsole.WriteLine(“Please enter your name”)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |