运算符 循环

其实
运算符与循环 很多东西都一样
以功能与模块来引导语句:
语句
if...else 其实这两个可以拆开的:
if (condition){statement(s)}:如果con是真的 执行 state 验证一个布尔值
if (condition)
{statement(s);}
else{other-statement(s);}

利用布尔值判断
筯加一个返回值通知用户出错

if(is_numeric($_post['month'])) //单引号如何输入
{$birthday = $_post['month'].'-';
}else{
print '

please select the month you were born.

';
$okay=FALSE;
}

验证用户输入的month是否为数字,如果是,赋值。如果不是,打印出错信息
这就是模块了
细节不需要管,你只需要知道这样的模块可以实现怎么样的功能就是了

使用手册的方法(必备技能)
foreach 用来处理数组
http://php.net/manual/en/function.is-numeric.php


if..elseif(else)

if..elseif
(4个分支选择判断,4个都是IF)

如果四个都不是
执行
else

下拉菜单返回值验证

switch:
case break
这个我打算选择其他例子,因为这个很重要



for(打印菜单选项的31天,估计是option(html标签)的重复)
while(数据库,读取文件) foreach(数组)

JavaScript
貌似特别多这类诡异句子
For...In 声明用于对数组或者对象的属性进行循环操作。
for ... in 循环中的代码每执行一次,就会对数组的元素或者对象的属性进行一次操作。
for (变量 in 对象)
{
在此执行代码
}

http://www.w3school.com.cn/js/js_loop_for_in.asp

try...catch 的作用是测试代码中的错误。
try
{
//在此运行代码
}
catch(err)
{
//在此处理错误
}

python:
if bear == "1":
print "The bear eats your face off. Good job!"
elif bear == "2":
print "The bear eats your legs off. Good job!"
else:
print "Well, doing %s is probably better. Bear runs away." % bear

elif:
http://readthedocs.org/docs/learn-python-the-hard-way-zh_cn-translation/en/latest/ex31.html


for...in

the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']

# this first kind of for-loop goes through a list
for number in the_count:
print "This is count %d" % number

# same as above
for fruit in fruits:
print "A fruit of type: %s" % fruit

# also we can go through mixed lists too
# notice we have to use %r since we don't know what's in it
for i in change:
print "I got %r" % i


while:
i = 0
numbers = []

while i < 6:
print "At the top i is %d" % i
numbers.append(i)

i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i


print "The numbers: "

for num in numbers:
print num