Monday, October 11, 2010

Monday, October 11, 2010

I am working on some console arrays from www.java2s.com


Sub Main()
Dim myInt As Integer = 7
Console.WriteLine("Initialzed myInt: {0}", myInt)
myInt = 5
Console.WriteLine("After assingment: myInt: {0}", myInt)

End Sub



Tutorial 2.3

Sub Main()
Dim n As Integer

n = 16
n += 102.3
n.ToString()
Console.WriteLine("Addition " & n)

n = 24
n -= 2
Console.WriteLine("Subtraction " & n)

n = 6
n *= 10
Console.WriteLine("Multiplication " & n)

n = 12
n /= 6
Console.WriteLine("Division " & n)

Console.ReadLine()

End Sub


Here is tutorial 2.2.4


Dim firstValue As Integer = 117
Dim secondValue As Integer = 123
Console.WriteLine("Before swap: {0}, {1}", firstValue, secondValue)
System.Threading.Thread.Sleep(700)

firstValue = firstValue Xor secondValue
Console.WriteLine("{0}, {1} ", firstValue, secondValue)
System.Threading.Thread.Sleep(800)

secondValue = firstValue Xor secondValue
Console.WriteLine("{0}, {1} ", firstValue, secondValue)
System.Threading.Thread.Sleep(800)

firstValue = firstValue Xor secondValue
Console.WriteLine("After swap: {0}, {1} ", firstValue, secondValue)
System.Threading.Thread.Sleep(2700)


Here is the next tutorial


Dim iNum As Integer
Console.WriteLine("Integer: " & iNum.MinValue & " to " & iNum.MaxValue)
Console.ReadLine()


Here is the next tutorial, with a try...catch...


Try
Dim numItams As Integer = Integer.Parse("123")

Catch ex As Exception
Console.WriteLine(ex.Message)

End Try


I also did a tutorial by Anne Boehm on arrays.


Dim arrayNumbers(9) As Integer
Dim numbersString As String = " "

For i As Integer = 0 To arrayNumbers.Length - 1
arrayNumbers(i) = i + 1
Next i

For Each number As Integer In arrayNumbers
numbersString &= number.ToString & " "
Next
MessageBox.Show(numbersString, "Numbers Test")

No comments: