Belajar Vb.Net : Looping Statement Vb.Net Lengkap

Tutorial lengkap Belajar Vb.Net : Loops statement - Looping Statement,Do Loop,For Next,For Each Next,While End While, With End With, Nested loops Vb.Net tutorial Lengkap khusus pemula

Tutorial Vb.Net - Belajar Visual Basic Net khusus pemula tentang Loops Statement di Vb.Net antara lain Do Loop,For Next,For Each Next,While End While, With End With, Nested loops yang akan di jelaskan pada tutorial vb.net ini, sebelumnya buat kamu yang ingin melihat tutorial vb net sebelumnya silahkan baca Tutorial VB.NET : CRUD (Create, Update, Delete) Vb.Net Database MySQLMembuat Laporan Biodata dengan Crystal Report Vb.Net, dan masih banyak yang lain, selengkapnya di Tutorial Belajar VB.NET Khusus Pemula. Untuk penggunaan Looping statement di vb net ini simak terus tutorialnya akan dijelaskan dibawah ini ya.
Belajar Vb.Net : Looping Statement Vb.Net Lengkap

Loops statement Vb.Net dan Contoh Penggunaannya

Do Loop Vb.net

Pernyataan Do Loop akan melakukan pengulangan dalam kondisi Boolean yang mana kondisi dalam keadaan True atau sampai kondisi dalam keadaan True. Pengulangan dapat dihentikan dengan pernyataan Exit do. Syntax statement Do Loop vb net
Do { While | Until } condition
    < statements >
    < Continue Do >
    < statements >
    < Exit Do >
    < statements >
Loop
Atau bisa juga :
Do
    < statements >
    < Continue Do >
    < statements >
    < Exit Do >
    < statements >
Loop { While | Until } condition

Contoh penggunaan Do Loop dalam aplikasi console

Module Module1
    Sub Main()
        Dim SC As Integer = 1
        Do
            Console.WriteLine("Do Lop Vb Net 1-20 : {0}", SC)
            SC = SC + 1
        Loop While (SC <= 20)
        Console.ReadLine()
    End Sub
End Module
Hasil yang ditampilkan adalah 1,2,3,4,5...20.
Coba lihat perbedaan menggunakan Loop While dengan menggunakan Loop Until vb net
Module Module1
    Sub Main()
        Dim SC As Integer = 1
        Do
            Console.WriteLine("Do Lop Vb Net 1-20 : {0}", SC)
            SC = SC + 1
        Loop Until (SC = 20)
        Console.ReadLine()
    End Sub
End Module
Akan menghasilkan 1,2,3,4,5.....19

For Next Vb Net

Statement For Next akan melakukan pengulangan dari sejumlah pernyataan tertentu dan menghitung jumlah index sebagai interasi jumlah pengulangan. Syntax statement for next vb.net
For counter [ As datatype ] = start To end [ Step step ]
    < statements >
    < Continue For >
    < statements >
    < Exit For >
    < statements >
Next < counter >

Contoh penggunaan statement for next vb net

Module Module1
    Sub Main()
        Dim SC As Byte
        For SC = 1 To 100
            Console.WriteLine("Loops For Next 1- 100 {0}", SC)
        Next
        Console.ReadLine()
    End Sub
End Module
Akan menghasilkan 1,2,3,4,5.....100
Kita akan menambahkan statemen Step pada For Next, lihat contoh berikut
Module Module1
    Sub Main()
        Dim SC As Byte
        For SC = 1 To 100 Step 5
            Console.WriteLine("Loops For Next 1- 100 {0}", SC)
        Next
        Console.ReadLine()
    End Sub
End Module
Akan menghasilkan nilai 1,6,11,16, .... 96

For Each Next Loops

Statement For Each Next akan melakukan pengulangan sekelompok dari pernyataan-pernyataan untuk semua elemen yang ada dalam index Array. Syntax penggunaan For Each Next Loops Vb.Net
For Each element [ As datatype ] In group
    < statements >
    < Continue For >
    < statements >
    < Exit For >
    < statements >
Next < element >

Contoh penggunaan for Each Next dalam aplikasi console

Module Module1
    Sub Main()
        Dim acontohArray() As Integer = {66, 666, 66666, 666, 66}
        Dim indexArray As Integer
        For Each indexArray In acontohArray 'menampilkan array
            Console.WriteLine(indexArray)
        Next
        Console.ReadLine()
    End Sub
End Module

While End While Statement Vb Net

Syntax While end while

While condition
    < statements >
    < Continue While >
    < statements >
    < Exit While >
    < statements >
End While

Contoh penggunaan While end while Statement

Module Module1
    Sub Main()
        Dim SC As Integer = 50
        While SC < 100
            Console.WriteLine("While End While {0}", SC)
            SC = SC + 1
        End While
        Console.ReadLine()
    End Sub
End Module

Hasil yang dimunculkan adalah angka 50,60,70....99

With End With Statement VB.

Syntax With End With statement

With object
    < statements >
End With

Contoh pengalikasian Statement With End With Aplikasi COnsole.

Module Module1
    Public Class Blogger
        Public Property Url As String
        Public Property Admin As String
        Public Property Umur As String
    End Class
    Sub Main()
        Dim blog As New Blogger
        With blog
            .Url = "http://scqq.blogspot.com/"
            .Admin = "Harison Ganteng"
            .Umur = "20 tahun kelahiran 1992"
        End With
        With blog
            Console.WriteLine(.Url)
            Console.WriteLine(.Admin)
            Console.WriteLine(.Umur)
        End With
        Console.ReadLine()
    End Sub
End Module

Nested For loop Vb Net

Syntax :

For counter1 [ As datatype1 ] = start1 To end1 [ Step step1 ]
    For counter2 [ As datatype2 ] = start2 To end2 [ Step step2 ]
    <....>
    Next [ counter2 ]
Next [ counter 1]

Contoh aplikasi console Nested For loop Vb Net

Module Module1
    Sub Main()
        Dim x, y As Integer
        For x = 2 To 100
            For y = 2 To x
                ' if factor found, not prime
                If ((x Mod y) = 0) Then
                    Exit For
                End If
            Next y
            If (y > (x \ y)) Then
                Console.WriteLine("{0} is prime", x)
            End If
        Next x
        Console.ReadLine()
    End Sub
End Module

Untuk referensi : http://www.tutorialspoint.com/vb.net/vb.net_loops.htm

Oh iya buat kamu yang ingin belajar Loops pada java silhkan baca Tutorial Java : LOOPING Perulangan While, do-while dan for.

Jangan lupa dishare jika bermanfaat ya, terima kasih

COMMENTS


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,89,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,6,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: Belajar Vb.Net : Looping Statement Vb.Net Lengkap
Belajar Vb.Net : Looping Statement Vb.Net Lengkap
Tutorial lengkap Belajar Vb.Net : Loops statement - Looping Statement,Do Loop,For Next,For Each Next,While End While, With End With, Nested loops Vb.Net tutorial Lengkap khusus pemula
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyw82UboYDYnvU1iVaBdCq46xICVoB5vjce5pDFBSYBNE_EnCofpknmenzMITmO5st9GpFluo7QZwNIeq0d054XShAuOjphWgMAEkfY6fFHx-kvRS7v0o5Ah0FhF4Gecmf88CMPKUq1fk/s320/looping-vb-net-pemula.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyw82UboYDYnvU1iVaBdCq46xICVoB5vjce5pDFBSYBNE_EnCofpknmenzMITmO5st9GpFluo7QZwNIeq0d054XShAuOjphWgMAEkfY6fFHx-kvRS7v0o5Ah0FhF4Gecmf88CMPKUq1fk/s72-c/looping-vb-net-pemula.png
KODE AJAIB
https://scqq.blogspot.com/2015/11/belajar-vbnet-looping-statement-aplikasi.html
https://scqq.blogspot.com/
https://scqq.blogspot.com/
https://scqq.blogspot.com/2015/11/belajar-vbnet-looping-statement-aplikasi.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy