From 93d3ab4578cd7c6e27f4d2b9468179528d326a22 Mon Sep 17 00:00:00 2001 From: Liam Demafelix Date: Sat, 31 Oct 2015 08:26:09 +0800 Subject: [vb/en] Additional note for select statements --- visualbasic.html.markdown | 3 +++ 1 file changed, 3 insertions(+) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index bdfdcc10..accdbf56 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -32,6 +32,9 @@ Module Module1 Console.WriteLine("50. About") Console.WriteLine("Please Choose A Number From The Above List") Dim selection As String = Console.ReadLine + ' The "Case" in the Select statement is optional. + ' For example, "Select selection" instead of "Select Case selection" + ' will also work. Select Case selection Case "1" 'HelloWorld Output Console.Clear() 'Clears the application and opens the private sub -- cgit v1.2.3 From 06c6c0fe2c03f6479c5906a807a88842b780cce9 Mon Sep 17 00:00:00 2001 From: poetienshul Date: Sat, 31 Oct 2015 23:20:00 -0400 Subject: visualbasic Commenting spacing inconsistency --- visualbasic.html.markdown | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index accdbf56..dfb89307 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -9,13 +9,13 @@ filename: learnvisualbasic.vb Module Module1 Sub Main() - ' A Quick Overview of Visual Basic Console Applications before we dive - ' in to the deep end. - ' Apostrophe starts comments. - ' To Navigate this tutorial within the Visual Basic Complier, I've put - ' together a navigation system. - ' This navigation system is explained however as we go deeper into this - ' tutorial, you'll understand what it all means. + 'A Quick Overview of Visual Basic Console Applications before we dive + 'in to the deep end. + 'Apostrophe starts comments. + 'To Navigate this tutorial within the Visual Basic Complier, I've put + 'together a navigation system. + 'This navigation system is explained however as we go deeper into this + 'tutorial, you'll understand what it all means. Console.Title = ("Learn X in Y Minutes") Console.WriteLine("NAVIGATION") 'Display Console.WriteLine("") @@ -32,9 +32,9 @@ Module Module1 Console.WriteLine("50. About") Console.WriteLine("Please Choose A Number From The Above List") Dim selection As String = Console.ReadLine - ' The "Case" in the Select statement is optional. - ' For example, "Select selection" instead of "Select Case selection" - ' will also work. + 'The "Case" in the Select statement is optional. + 'For example, "Select selection" instead of "Select Case selection" + 'will also work. Select Case selection Case "1" 'HelloWorld Output Console.Clear() 'Clears the application and opens the private sub @@ -91,12 +91,12 @@ Module Module1 'Two Private Sub HelloWorldInput() Console.Title = "Hello World YourName | Learn X in Y Minutes" - ' Variables - ' Data entered by a user needs to be stored. - ' Variables also start with a Dim and end with an As VariableType. + 'Variables + 'Data entered by a user needs to be stored. + 'Variables also start with a Dim and end with an As VariableType. - ' In this tutorial, we want to know what your name, and make the program - ' respond to what is said. + 'In this tutorial, we want to know what your name, and make the program + 'respond to what is said. Dim username As String 'We use string as string is a text based variable. Console.WriteLine("Hello, What is your name? ") 'Ask the user their name. -- cgit v1.2.3 From 05dac0dd3536dcf98c453198e6ebab5c122848a8 Mon Sep 17 00:00:00 2001 From: ioab Date: Wed, 4 Nov 2015 00:07:37 +0300 Subject: [vb/en] typos correction --- visualbasic.html.markdown | 64 +++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index dfb89307..4f696262 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -45,10 +45,10 @@ Module Module1 Case "3" 'Calculating Whole Numbers Console.Clear() CalculatingWholeNumbers() - Case "4" 'Calculting Decimal Numbers + Case "4" 'Calculating Decimal Numbers Console.Clear() CalculatingDecimalNumbers() - Case "5" 'Working Calcculator + Case "5" 'Working Calculator Console.Clear() WorkingCalculator() Case "6" 'Using Do While Loops @@ -77,10 +77,10 @@ Module Module1 'One - I'm using numbers to help with the above navigation when I come back 'later to build it. - 'We use private subs to seperate different sections of the program. + 'We use private subs to separate different sections of the program. Private Sub HelloWorldOutput() 'Title of Console Application - Console.Title = "Hello World Ouput | Learn X in Y Minutes" + Console.Title = "Hello World Output | Learn X in Y Minutes" 'Use Console.Write("") or Console.WriteLine("") to print outputs. 'Followed by Console.Read() alternatively Console.Readline() 'Console.ReadLine() prints the output to the console. @@ -102,7 +102,7 @@ Module Module1 Console.WriteLine("Hello, What is your name? ") 'Ask the user their name. username = Console.ReadLine() 'Stores the users name. Console.WriteLine("Hello " + username) 'Output is Hello 'Their name' - Console.ReadLine() 'Outsputs the above. + Console.ReadLine() 'Outputs the above. 'The above will ask you a question followed by printing your answer. 'Other variables include Integer and we use Integer for whole numbers. End Sub @@ -110,7 +110,7 @@ Module Module1 'Three Private Sub CalculatingWholeNumbers() Console.Title = "Calculating Whole Numbers | Learn X in Y Minutes" - Console.Write("First number: ") 'Enter a whole number, 1, 2, 50, 104 ect + Console.Write("First number: ") 'Enter a whole number, 1, 2, 50, 104, etc Dim a As Integer = Console.ReadLine() Console.Write("Second number: ") 'Enter second whole number. Dim b As Integer = Console.ReadLine() @@ -126,7 +126,7 @@ Module Module1 'Of course we would like to be able to add up decimals. 'Therefore we could change the above from Integer to Double. - 'Enter a whole number, 1.2, 2.4, 50.1, 104.9 ect + 'Enter a whole number, 1.2, 2.4, 50.1, 104.9 etc Console.Write("First number: ") Dim a As Double = Console.ReadLine Console.Write("Second number: ") 'Enter second whole number. @@ -153,7 +153,7 @@ Module Module1 Dim f As Integer = a / b 'By adding the below lines we are able to calculate the subtract, - 'multply as well as divide the a and b values + 'multiply as well as divide the a and b values Console.Write(a.ToString() + " + " + b.ToString()) 'We want to pad the answers to the left by 3 spaces. Console.WriteLine(" = " + c.ToString.PadLeft(3)) @@ -199,7 +199,7 @@ Module Module1 Console.Write("Would you like to continue? (yes / no)") 'The program grabs the variable and prints and starts again. answer = Console.ReadLine - 'The command for the variable to work would be in this case "yes" + 'The command for the variable to work would be in this case "yes" Loop While answer = "yes" End Sub @@ -211,7 +211,7 @@ Module Module1 Console.Title = "Using For Loops | Learn X in Y Minutes" 'Declare Variable and what number it should count down in Step -1, - 'Step -2, Step -3 ect. + 'Step -2, Step -3 etc. For i As Integer = 10 To 0 Step -1 Console.WriteLine(i.ToString) 'Print the value of the counter Next i 'Calculate new value @@ -238,36 +238,36 @@ Module Module1 'Nine Private Sub IfElseStatement() - Console.Title = "If / Else Statement | Learn X in Y Minutes" + Console.Title = "If / Else Statement | Learn X in Y Minutes" 'Sometimes it is important to consider more than two alternatives. 'Sometimes there are a good few others. 'When this is the case, more than one if statement would be required. 'An if statement is great for vending machines. Where the user enters a code. - 'A1, A2, A3, ect to select an item. + 'A1, A2, A3, etc to select an item. 'All choices can be combined into a single if statement. Dim selection As String = Console.ReadLine 'Value for selection - Console.WriteLine("A1. for 7Up") - Console.WriteLine("A2. for Fanta") - Console.WriteLine("A3. for Dr. Pepper") - Console.WriteLine("A4. for Diet Coke") + Console.WriteLine("A1. for 7Up") + Console.WriteLine("A2. for Fanta") + Console.WriteLine("A3. for Dr. Pepper") + Console.WriteLine("A4. for Diet Coke") + Console.ReadLine() + If selection = "A1" Then + Console.WriteLine("7up") Console.ReadLine() - If selection = "A1" Then - Console.WriteLine("7up") - Console.ReadLine() - ElseIf selection = "A2" Then - Console.WriteLine("fanta") - Console.ReadLine() - ElseIf selection = "A3" Then - Console.WriteLine("dr. pepper") - Console.ReadLine() - ElseIf selection = "A4" Then - Console.WriteLine("diet coke") - Console.ReadLine() - Else - Console.WriteLine("Please select a product") - Console.ReadLine() - End If + ElseIf selection = "A2" Then + Console.WriteLine("fanta") + Console.ReadLine() + ElseIf selection = "A3" Then + Console.WriteLine("dr. pepper") + Console.ReadLine() + ElseIf selection = "A4" Then + Console.WriteLine("diet coke") + Console.ReadLine() + Else + Console.WriteLine("Please select a product") + Console.ReadLine() + End If End Sub -- cgit v1.2.3 From d92db6ea39723c7778b225de0f27d977bdee0b99 Mon Sep 17 00:00:00 2001 From: ioab Date: Wed, 4 Nov 2015 00:24:43 +0300 Subject: [vb/en] fix type inconsistencies for calculator subs --- visualbasic.html.markdown | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index 4f696262..d6d1759d 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -126,10 +126,10 @@ Module Module1 'Of course we would like to be able to add up decimals. 'Therefore we could change the above from Integer to Double. - 'Enter a whole number, 1.2, 2.4, 50.1, 104.9 etc + 'Enter a floating-point number, 1.2, 2.4, 50.1, 104.9 etc Console.Write("First number: ") Dim a As Double = Console.ReadLine - Console.Write("Second number: ") 'Enter second whole number. + Console.Write("Second number: ") 'Enter second floating-point number. Dim b As Double = Console.ReadLine Dim c As Double = a + b Console.WriteLine(c) @@ -145,12 +145,12 @@ Module Module1 'Copy and paste the above again. Console.Write("First number: ") Dim a As Double = Console.ReadLine - Console.Write("Second number: ") 'Enter second whole number. - Dim b As Integer = Console.ReadLine - Dim c As Integer = a + b - Dim d As Integer = a * b - Dim e As Integer = a - b - Dim f As Integer = a / b + Console.Write("Second number: ") 'Enter second floating-point number. + Dim b As Double = Console.ReadLine + Dim c As Double = a + b + Dim d As Double = a * b + Dim e As Double = a - b + Dim f As Double = a / b 'By adding the below lines we are able to calculate the subtract, 'multiply as well as divide the a and b values @@ -179,11 +179,11 @@ Module Module1 Console.Write("First number: ") Dim a As Double = Console.ReadLine Console.Write("Second number: ") - Dim b As Integer = Console.ReadLine - Dim c As Integer = a + b - Dim d As Integer = a * b - Dim e As Integer = a - b - Dim f As Integer = a / b + Dim b As Double = Console.ReadLine + Dim c As Double = a + b + Dim d As Double = a * b + Dim e As Double = a - b + Dim f As Double = a / b Console.Write(a.ToString() + " + " + b.ToString()) Console.WriteLine(" = " + c.ToString.PadLeft(3)) @@ -196,7 +196,7 @@ Module Module1 Console.ReadLine() 'Ask the question, does the user wish to continue? Unfortunately it 'is case sensitive. - Console.Write("Would you like to continue? (yes / no)") + Console.Write("Would you like to continue? (yes / no) ") 'The program grabs the variable and prints and starts again. answer = Console.ReadLine 'The command for the variable to work would be in this case "yes" -- cgit v1.2.3 From 4552c56f03754ac6349c96ab73f794ecf1861254 Mon Sep 17 00:00:00 2001 From: ioab Date: Wed, 4 Nov 2015 00:49:44 +0300 Subject: [vb/en] remove unnecessary lines. Improve conditions (8 and 9) subs. --- visualbasic.html.markdown | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index d6d1759d..30d03f77 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -222,7 +222,7 @@ Module Module1 'Eight Private Sub ConditionalStatement() Console.Title = "Conditional Statements | Learn X in Y Minutes" - Dim userName As String = Console.ReadLine + Dim userName As String Console.WriteLine("Hello, What is your name? ") 'Ask the user their name. userName = Console.ReadLine() 'Stores the users name. If userName = "Adam" Then @@ -244,30 +244,28 @@ Module Module1 'When this is the case, more than one if statement would be required. 'An if statement is great for vending machines. Where the user enters a code. 'A1, A2, A3, etc to select an item. - 'All choices can be combined into a single if statement. + 'All choices can be combined into a single if block. - Dim selection As String = Console.ReadLine 'Value for selection + Dim selection As String 'Declare a variable for selection + Console.WriteLine("Please select a product form our lovely vending machine.") Console.WriteLine("A1. for 7Up") Console.WriteLine("A2. for Fanta") Console.WriteLine("A3. for Dr. Pepper") Console.WriteLine("A4. for Diet Coke") - Console.ReadLine() + + selection = Console.ReadLine() 'Store a selection from the user If selection = "A1" Then Console.WriteLine("7up") - Console.ReadLine() ElseIf selection = "A2" Then Console.WriteLine("fanta") - Console.ReadLine() ElseIf selection = "A3" Then Console.WriteLine("dr. pepper") - Console.ReadLine() ElseIf selection = "A4" Then Console.WriteLine("diet coke") - Console.ReadLine() Else - Console.WriteLine("Please select a product") - Console.ReadLine() + Console.WriteLine("Sorry, I don't have any " + selection) End If + Console.ReadLine() End Sub -- cgit v1.2.3 From d50fc51aa615267ab78d18e046e94ec68529fdeb Mon Sep 17 00:00:00 2001 From: ioab Date: Sun, 8 Nov 2015 23:46:41 +0300 Subject: correction --- visualbasic.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'visualbasic.html.markdown') diff --git a/visualbasic.html.markdown b/visualbasic.html.markdown index 30d03f77..0371e6f6 100644 --- a/visualbasic.html.markdown +++ b/visualbasic.html.markdown @@ -126,7 +126,7 @@ Module Module1 'Of course we would like to be able to add up decimals. 'Therefore we could change the above from Integer to Double. - 'Enter a floating-point number, 1.2, 2.4, 50.1, 104.9 etc + 'Enter a floating-point number, 1.2, 2.4, 50.1, 104.9, etc Console.Write("First number: ") Dim a As Double = Console.ReadLine Console.Write("Second number: ") 'Enter second floating-point number. @@ -211,7 +211,7 @@ Module Module1 Console.Title = "Using For Loops | Learn X in Y Minutes" 'Declare Variable and what number it should count down in Step -1, - 'Step -2, Step -3 etc. + 'Step -2, Step -3, etc. For i As Integer = 10 To 0 Step -1 Console.WriteLine(i.ToString) 'Print the value of the counter Next i 'Calculate new value -- cgit v1.2.3