Skip to content

Commit a08744d

Browse files
authored
Add files via upload
1 parent 5925a6d commit a08744d

37 files changed

+1261
-0
lines changed

01-Hello-print.vb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module hello
7+
sub main()
8+
console.writeline("Hello World" , 2024)
9+
end sub
10+
end module

02-Variables.vb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module Variables
7+
sub main()
8+
dim num as integer = 10
9+
dim float as double = 3.14
10+
dim ch as char = "C"
11+
dim bool as boolean = True
12+
dim str as string = "Hello"
13+
14+
console.writeline("{0} , {1}, {2}, {3}, {4}", num, float,ch,bool,str)
15+
end sub
16+
end module

03-Input-Output-console.vb

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module IOConsole
7+
sub main()
8+
dim num as integer
9+
dim float as double
10+
dim ch as char
11+
dim bool as boolean
12+
dim str as string
13+
14+
console.writeline("Enter integer : ")
15+
num = integer.parse(console.readline())
16+
console.writeline("Enter double : ")
17+
float = double.parse(console.readline())
18+
console.writeline("Enter character : ")
19+
ch = console.readline()
20+
console.writeline("Enter boolean (True or False) : ")
21+
bool = boolean.parse(console.readline())
22+
console.writeline("Enter String : ")
23+
str = console.readline()
24+
25+
console.writeline("{0} , {1}, {2}, {3}, {4}", num, float,ch,bool,str)
26+
27+
console.writeline("Enter any key to exit...........")
28+
console.readkey()
29+
30+
end sub
31+
end module

04-Arithmetic-Operators.vb

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
' ^ : It is an exponentiation Operator that is used to raises one operand to the power of another operand. Y ^ X (X to the power Y)
5+
' + : The addition Operator is used to add numeric data, as well as concatenate two string variables. X + Y
6+
' - : It is a subtraction Operator, which is used to subtract the second operand from the first operand. X - Y
7+
' * : The multiplication Operator is used to multiply the operands X * Y
8+
' / : It is a division Operator used to divide one operand by another operand and returns a floating-point result. X / Y
9+
' \ : It is an integer division Operator, which is similar to division Operator, except that it returns an integer result while dividing one operand to another operand. X \ Y
10+
' Mod : It is a modulo (Modulus) Operator, which is used to divide two operands and returns only a remainder. X Mod Y
11+
12+
Imports System
13+
14+
module ArithmeticOperators
15+
sub main()
16+
17+
dim a as integer = 5
18+
dim b as integer = 2
19+
console.writeline("a/b : {0}", a/b)
20+
console.writeline("a\b : {0}", a\b)
21+
console.writeline("a mod b : {0}", a mod b)
22+
console.writeline("a^b : {0}", a^b)
23+
24+
end sub
25+
end module

05-Comparision-Operator.vb

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
' = : It checks whether the value of the two operands is equal; If yes, it returns a true value, otherwise it shows False. (A = B)
5+
' <> : It is a Non-Equality Operator that checks whether the value of the two operands is not equal; it returns true; otherwise, it shows false. (A <> B), check Non-Equality
6+
' > : A greater than symbol or Operator is used to determine whether the value of the left operand is greater than the value of the right operand; If the condition is true, it returns TRUE; otherwise, it shows FALSE value. (A > B); if yes, TRUE, Else FALSE
7+
' < : It is a less than symbol which checks whether the value of the left operand is less than the value of the right operand; If the condition is true, it returns TRUE; otherwise, it shows FALSE value. (A < B); if the condition is true, returns TRUE else FALSE
8+
' >= : It is greater than equal to which checks two conditions whether the first operand is greater than or equal to the second operand; if yes, it returns TRUE; otherwise, it shows False. A >= B
9+
' <= : This symbol represents less than equal to which determines the first operand is less than or equal to the second operand, and if the condition is true, it returns TRUE; otherwise, it shows FALSE. A <= B
10+
' Is : The Is Operator is used to validate whether the two objects reference the same variable or object; If the test is true, it returns True; otherwise, the result is False. In short, it checks the equality of the objects. An Is Operator is also used to determine whether the object refers to a valid object. result = obj1 Is obj2
11+
' IsNot : The IsNot Operator is similar to Is Operator, except that the two object references the different object; if yes, the result is True; otherwise, the result is False. Result = obj1 IsNot obj2
12+
' Like :The Like Operator is used to check the pattern expression of string variable; And if the pattern matched, the result is True; otherwise, it returns False. result = string Like the pattern, the pattern represents the series of characters used by Like Operator.
13+
14+
Imports System
15+
16+
module ComparisionOperators
17+
sub main()
18+
19+
dim x as integer = 5
20+
dim y as integer = 10
21+
dim result, obj1, obj2 as object
22+
dim str1, str2 as string
23+
str1 = "Apple12345"
24+
str2 = "Apple12345"
25+
obj1 = 10
26+
obj2 = 20
27+
28+
Console.WriteLine("x = y : {0}", x = y)
29+
Console.WriteLine("x <> y : {0}", x <> y)
30+
31+
Console.WriteLine("obj1 = obj2 : {0}", obj1 = obj2)
32+
Console.WriteLine("obj1 is obj2 : {0}", obj1 is obj2)
33+
Console.WriteLine("obj1 isnot obj2 : {0}", obj1 isnot obj2)
34+
35+
Console.WriteLine("str1 = str2 : {0}", str1 = str2)
36+
Console.WriteLine("str1 is str2 : {0}", str1 is str2)
37+
38+
result = str1 Like str2
39+
Console.WriteLine("str1 Like str2 : {0}", Result)
40+
41+
42+
end sub
43+
end module

06-Bitwise-Operator.vb

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
' And : The And Operator represents, whether both the operands are true; the result is True. (A And B), result = False
5+
' Or : It is an Or Operator that returns a true value; if anyone operand is true from both the operands. (A Or B), result = True
6+
' Not : The Not Operator is used to reverse the logical condition. For example, if the operand's logic is True, it reveres the condition and makes it False. Not A Or Not(A And B) is True
7+
' Xor : It is an Exclusive OR Operator that represents, whether both the expression is true or false, the result is True; otherwise, the result is False. A Xor B is True
8+
' AndAlso : It is a logical AND Operator that performs short-circuit operation on the variables, and if both the operands are true, the result is True else the result is False. A AndAlso B = False
9+
' OrElse : It is a logical OR Operator that perform short-circuit operation on Boolean data. If anyone of the operand is true, the result is True else the result is False. A OrElse B = True
10+
' IsFalse : The IsFalse Operator is used to determine whether an expression is False.
11+
' IsTrue : The IsTrue Operator is used to determine whether an expression is True.
12+
13+
Imports System
14+
15+
module BitwiseOperators
16+
sub main()
17+
dim a as boolean = true
18+
dim b as boolean = false
19+
console.writeline("a and b : {0}", a and b)
20+
console.writeline("a or b : {0}", a or b)
21+
console.writeline("a xor b : {0}", a xor b)
22+
console.writeline("not(a and b) : {0}", not (a and b))
23+
24+
end sub
25+
end module

07-Concate-Operands.vb

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
' & : It is an ampersand symbol that is used to bind two or more operand together. Furthermore, a nonstring operand can also be concatenated with a string variable ( but in that case, Option Strict is on). Result = Wel & come, Result = Welcome
5+
' + : It is also used to add or concatenate two number or string. Result = Wel + come, Result = Welcome
6+
7+
Imports System
8+
9+
module ConcateOperands
10+
sub main()
11+
dim a as integer = 10
12+
dim b as integer = 20
13+
dim str1 As string = "Wel"
14+
dim str2 As string = "come"
15+
console.writeline("a & b : {0}", a & b)
16+
console.writeline("a + b : {0}", a + b)
17+
console.writeline("str1 & str2 : {0}", str1 & str2)
18+
console.writeline("str1 + str2 : {0}", str1 + str2)
19+
end sub
20+
end module

08-If-Then-ElseIf-Statement.vb

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module IfElseStatement
7+
sub main()
8+
dim a,b,c as integer
9+
a = 5
10+
b = 10
11+
c = 8
12+
13+
if a > b and a > c then
14+
console.writeline("Max: {0}",a)
15+
elseif b > a and b > c then
16+
console.writeline("Max: {0}",b)
17+
else
18+
console.writeline("Max: {0}",c)
19+
end if ' end if statement
20+
21+
end sub
22+
end module

09-Select-Statement.vb

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module SelectCase
7+
8+
sub Main()
9+
dim Days as string
10+
Days = "Thurs"
11+
select case Days
12+
case "Mon"
13+
Console.WriteLine("Monday")
14+
case "Tue"
15+
Console.WriteLine("Tuesday")
16+
case "Wed"
17+
Console.WriteLine("Wednesday")
18+
case "Thurs"
19+
Console.WriteLine("Thursday")
20+
case "Fri"
21+
Console.WriteLine("Friday")
22+
case "Sat"
23+
Console.WriteLine("Saturday")
24+
case "Sun"
25+
Console.WriteLine("Sunday")
26+
case else
27+
Console.WriteLine("Invalid Input")
28+
end select
29+
end sub
30+
end module

10-While-and-do-while-loop.vb

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module whileLoops
7+
sub main()
8+
dim i As integer = 1
9+
10+
console.writeline("-----do-while-----")
11+
12+
do
13+
console.writeline("I is : {0}", i)
14+
i = i + 1
15+
loop while i <= 5
16+
17+
i = 1
18+
console.writeline("-----while-----")
19+
while i <= 5
20+
console.writeline("I is : {0}", i)
21+
i = i + 1
22+
end while
23+
end sub
24+
end module

11-For-Next-and-For-Each-loop.vb

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module forLoops
7+
sub main()
8+
console.writeline("------for-next------")
9+
for i As integer = 1 To 5 step 1
10+
console.writeline(" I is {0} ", i)
11+
next
12+
13+
console.writeline("------for-each------")
14+
dim arr() as integer = {11, 12, 13, 14, 15}
15+
dim obj as integer
16+
17+
for each obj as integer in arr
18+
console.writeline("obj is {0}", obj)
19+
next
20+
21+
end sub
22+
end module

12-With-End.vb

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
4+
Imports System
5+
6+
module Withend
7+
class Student
8+
public name as string
9+
public course as string
10+
public rollno as integer
11+
end class
12+
13+
sub main()
14+
dim std as new Student()
15+
16+
' To define the member of an object using With Statement
17+
with std
18+
.name = " Mr. Jaydatt"
19+
.course = "Computer"
20+
.rollno = 1
21+
end with
22+
23+
with std
24+
' use std as a reference
25+
console.writeline("Name is : {0}", .name)
26+
console.writeline("Course Name is : {0}", .course)
27+
console.writeline("RollNo. is : {0}", .rollno)
28+
end with
29+
30+
end sub
31+
end module

13-Exit-with-for-while-do-while.vb

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
' Author : Jaydatt Patel
2+
' VB.Net is not case sensitive.
3+
'the Exit statement is used to terminate the loop (for, while, do, select case, etc.) or exit the loop and pass control immediately to the next statement of the termination loop.
4+
5+
Imports System
6+
7+
module ExitStatement
8+
sub main()
9+
dim i as integer
10+
11+
console.writeline("------Exit with for-----")
12+
for i = 1 to 10 step 1
13+
if i > 5 then
14+
exit for ' exit for loop
15+
end if
16+
console.writeline("i : {0}",i)
17+
next
18+
19+
console.writeline("------Exit with while-----")
20+
i = 1
21+
while i < 10
22+
if i > 5 then
23+
exit while ' exit while loop
24+
end if
25+
console.writeline("i : {0}",i)
26+
i += 1
27+
end while
28+
29+
console.writeline("------Exit with do while-----")
30+
i = 1
31+
do
32+
if i > 5 then
33+
exit do ' exit do while loop
34+
end if
35+
console.writeline("i : {0}",i)
36+
i += 1
37+
loop while i < 10
38+
39+
end sub
40+
end module

0 commit comments

Comments
 (0)