Language agnostic 如何编写While循环
如何编写While循环的语法 CLanguage agnostic 如何编写While循环,language-agnostic,conditional,Language Agnostic,Conditional,如何编写While循环的语法 C# VB.Net 在PHP中,while循环如下所示: <?php while(CONDITION) { //Do something here. } ?> 现实世界中的例子可能是这样的 <?php //MySQL query stuff here $result = mysql_query($sql, $link) or die("Opps"); while($row = mysql_fetch_assoc($result)) { $_S
#
VB.Net
在PHP中,while循环如下所示:
<?php
while(CONDITION)
{
//Do something here.
}
?>
现实世界中的例子可能是这样的
<?php
//MySQL query stuff here
$result = mysql_query($sql, $link) or die("Opps");
while($row = mysql_fetch_assoc($result))
{
$_SESSION['fName'] = $row['fName'];
$_SESSION['lName'] = $row['lName'];
//...
}
?>
这类问题可能有位置,但前提是答案正确<代码>而不是C#中的关键字<代码>而处于禁用状态。还有,
之间的空格代码>和=
无效。尝试:
int i=0;
while (i != 10)
{
Console.WriteLine(i);
i++;
}
当我在这里时
TCL
C++、C、JavaScript、Java和无数其他类似C的语言看起来都与C#完全相同,只是它们将输出写入控制台的方式不同,或者可能是创建变量i
的方式不同。回答这个问题应该是另一个问题。这是有原因的。哇!我现在感觉好多了。
i = 0
while i != 10:
print i
i += 1
<?php
while(CONDITION)
{
//Do something here.
}
?>
<?php
//MySQL query stuff here
$result = mysql_query($sql, $link) or die("Opps");
while($row = mysql_fetch_assoc($result))
{
$_SESSION['fName'] = $row['fName'];
$_SESSION['lName'] = $row['lName'];
//...
}
?>
int i=0;
while (i != 10)
{
Console.WriteLine(i);
i++;
}
i = 0
while i != 10:
print i
i += 1
set i 0
while {$i != 10} {
puts $i
incr i
}