While Loop

From SwiftAPI

Jump to: navigation, search

Contents

C/C++

int i = 0;
while(i < 5) {
    i = i + 1;
}
// i == 5

C#

int i = 0;
while(i < 5) 
{
    i = i + 1;
}
// i == 5

Java

int i = 0;
while(i < 5) {
    i = i + 1;
}
// i == 5

JavaScript

developer.mozilla.org

var i = 0;
while(i < 5) {
    i = i + 1;
}
// i == 5

Perl

$i = 0;
while($i < 5) {
    $i = $i + 1;
}
# $i == 5

PHP

php.net

$i = 0;
while($i < 5) {
    $i = $i + 1;
}
// $i == 5

Python

docs.python.org

i = 0
while i < 5:
    i = i + 1
# i == 5

Ruby

i = 0
while i < 5
    i = i + 1
end
# i == 5

Swift

var i = 0
while i < 5 {
    i = i + 1
}
// i == 5

Visual Basic .NET

Dim i As Integer = 0
While i < 5
    i = i + 5
End While
' i = 5
Personal tools