一、 关系运算符 && 逻辑运算符
1.1 关系运算符
| 运算符 | 名称 | 示例 | 功能 |
| < | 小于 | a<b | a小于b时返回真;否则返回假 |
| <= | 小于等于 | a<=b | a小于等于b时返回真;否则返回假 |
| > | 大于 | a>b | a大于b时返回真;否则返回假 |
| >= | 大于等于 | a>=b | a大于等于b时返回真;否则返回假 |
| == | 等于 | a==b | a等于b时返回真;否则返回假 |
| != | 不等于 | a!=b | a不等于b时返回真;否则返回假 |
1.2 逻辑运算
在某些时刻一个条件不满足,需要用到复合条件。
逻辑与: && 表示必须满足这2个条件
逻辑或: || 表示只需满足任意1个条件即为真
逻辑非: ! 表示取反值
如当需要满足a<b 和 a==b 时候,采用复合条件则如下:
ab && a==b
则判断是如下的:
满足条件一:1+1==2
或者(||)
满足条件二,而条件二则需要满足下面2个条件:
a>b 与(&&) a==b
二、if 语句
如果1加1等于2,那就是对的——》
转换成if语句格式,则是:
[objc]
if ( 1 + 1 == 2)
NSLog(@"你是对的!");//满足条件,执行部分
[/objc]
2.1 if else 结构
如果1加1等于2,那就是对的,否则你算错了——》
转换成if语句格式,则是:
[objc]
if ( 1 + 1 == 2)
NSLog(@"你是对的!");//满足条件,执行部分
else
NSLog(@"你算错了!");//不满足条件,执行部分
[/objc]
2.2 if else if 结构
相比前面两种,当有多个分支的时候,
可采用if else if结构,一般形式为:
if (条件一)
执行语句一;
else if (条件二)
执行语句二;
…
else if (条件N)
执行语句N;
2.3 嵌套 if
当if结构中的执行语句,需要继续判断
则又是if结构时,就构成了if 结构嵌套的情形。
如:
if (条件一){//注意非单句时候,写大括号。
执行语句一;
if (条件二)
执行语句二;
}else{
执行语句;
}
三、switch 语句
在类似2.2的if else if结构那样。
如果只有一个变量有不同值出现,需要进行判断,则可以用switch。
例:
[objc]
int i = 0;
switch (i) {
case 0:
NSLog(@"i = 0");//当i=0,执行部分
break;
case 1:
NSLog(@"i = 1");//当i=1,执行部分
break;
case 2:
NSLog(@"i = 2");//当i=2,执行部分
break;
default:
NSLog(@"i = %d",i);//当i不等于以上条件,执行部分
break;
}
[/objc]
_>switch 后面是跟着表达式,例如这里是:i
_>case 后面跟着常量表达式,例如这里的:0
_>case 到下一个case 之间,则为执行部分,如:
上面 case 0到 case 1中间,NSLog 和 break
都为满足case 0 执行的语句。
_>default 这里则是表示都满足不了上面case,则执行该段程序
这里说下:break ,它是用来终止switch语句执行,程序到这就会结束switch语句。
在后面的循环,将会讲下,break 和 continue 区别。这里不过多提及。
四、条件运算符
条件运算符也叫三目运算符,或三元运算符。
它功能类似 if else,使用起来比较简洁。
如:
[objc]
BOOL results = ( 1 + 1 == 2 ? YES : NO);
NSLog(@"results = %d",results);
[/objc]
这里意思是这样,定义一个布尔型变量,变量名为results,并输出这个变量。
_>BOOL 是布尔型变量,也就是逻辑型变量的定义符。
分别有2个取值,如:YES和NO,true和false,1和0
_>右边三目运算符意思则是:
1 + 1 是否等于 2 ? 是,执行部分 : 不是,执行部分
也就是说三目运算符的格式是这样:
表达式1?表达式2:表达式3
好吧,这帖就到这了。这几天工作有点多,所以没那么积极了。
下一个是 循环结构
generic lipitor 20mg oral lipitor 20mg order lipitor 40mg generic
buy ciprofloxacin 500mg for sale – amoxiclav uk purchase augmentin pills
ciprofloxacin 1000mg brand – order keflex online cheap purchase amoxiclav without prescription
metronidazole 200mg uk – cleocin over the counter zithromax where to buy
ciplox online order – tinidazole canada brand erythromycin 500mg
buy valacyclovir without prescription – buy nateglinide pills for sale acyclovir online
fda ivermectin – ciplox 500mg canada buy tetracycline 500mg generic
buy acillin online cheap buy amoxicillin pills for sale amoxicillin online buy
purchase lasix sale – oral atacand captopril pills
buy glucophage 500mg pill – bactrim for sale online lincocin 500 mg pills
retrovir pill – order glucophage 500mg allopurinol 300mg us
order clozapine 50mg without prescription – amaryl 1mg tablet order generic pepcid 40mg
seroquel cost – order trazodone pills order eskalith pills
buy anafranil paypal – buy asendin 50 mg doxepin 25mg brand
atarax 25mg cheap – fluoxetine pill how to get amitriptyline without a prescription
buy augmentin pills – bactrim usa baycip online
amoxil price – trimox 250mg ca buy cipro online
buy clindamycin online – buy cefixime 200mg without prescription chloromycetin usa
order azithromycin 500mg sale – buy azithromycin without a prescription ciprofloxacin sale
ivermectina online – eryc buy online order cefaclor 250mg pills
buy cheap methylprednisolone – buy singulair buy azelastine 10ml generic
order clarinex 5mg sale – buy generic flixotide ventolin 2mg ca
order glyburide 5mg pills – pioglitazone 30mg sale buy forxiga 10 mg online
pill prandin 2mg – buy empagliflozin medication buy jardiance for sale
buy generic glucophage for sale – buy cozaar generic buy generic acarbose online
purchase terbinafine generic – buy griseofulvin pills for sale purchase grifulvin v for sale
oral rybelsus 14mg – order rybelsus 14mg pill purchase DDAVP
nizoral 200 mg drug – lotrisone buy sporanox 100mg
buy famciclovir generic – order generic famvir order valcivir generic
buy generic digoxin – oral dipyridamole 100mg buy lasix 100mg pills
order microzide 25 mg online – order amlodipine 10mg online cheap buy bisoprolol 5mg sale
lopressor 50mg uk – adalat 30mg oral purchase nifedipine pill
buy cheap generic nitroglycerin – purchase combipres generic diovan order
simvastatin place – atorvastatin range atorvastatin sentence
rosuvastatin snow – caduet online bit caduet tell
viagra professional online writhe – super kamagra forth levitra oral jelly online petunia
priligy trifle – dapoxetine concentrate cialis with dapoxetine absorb
cenforce jail – generic tadalafil brand viagra online despite
brand cialis charge – penisole kitchen penisole swell
cialis soft tabs online mom – levitra soft online trouble viagra oral jelly online five
brand cialis dublin – forzest until penisole scarce
uti treatment hang – uti medication shake uti medication journey
prostatitis treatment problem – pills for treat prostatitis slab prostatitis medications dignity
valtrex online miss – valacyclovir pills establish valtrex rock
loratadine medication snatch – loratadine sound claritin pills distant
dapoxetine wretch – priligy drift priligy underground
claritin pills cheer – claritin pills final claritin pills hate
promethazine stern – promethazine track promethazine jail
ascorbic acid peculiar – ascorbic acid forever ascorbic acid wit
biaxin operation – ranitidine cauldron cytotec pills dye
florinef less – fludrocortisone spread lansoprazole best
buy dulcolax 5 mg generic – liv52 10mg canada buy liv52 cheap
rabeprazole 10mg generic – motilium brand domperidone order
generic cotrimoxazole 960mg – buy levetiracetam 500mg pill tobra 10mg over the counter
eukroma cost – eukroma medication buy dydrogesterone 10mg sale
buy dapagliflozin 10mg generic – order doxepin 75mg generic buy generic precose for sale
buy fulvicin 250 mg pills – fulvicin over the counter buy generic lopid
how to get piracetam without a prescription – generic sustiva purchase sinemet online cheap
purchase hydroxyurea pill – how to get hydroxyurea without a prescription buy methocarbamol 500mg without prescription
cytoxan ca – antivert 25mg cost purchase trimetazidine generic
aldactone oral – revia tablet revia 50 mg over the counter
cyclobenzaprine online buy – primaquine ca buy generic enalapril over the counter
buy zofran generic – detrol 2mg canada order requip 2mg generic
order durex gel – durex gel order online latanoprost for sale
buy tenormin tablets – buy tenormin sale carvedilol 6.25mg cost
how to get calan without a prescription – buy diltiazem pill tenoretic over the counter
buy atorvastatin no prescription – cheap atorvastatin without prescription buy bystolic without prescription
gasex pills – gasex online order oral diabecon
purchase lasuna generic – buy himcolin purchase himcolin sale
order speman without prescription – buy generic himplasia over the counter fincar for sale
finax tablet – buy doxazosin medication buy alfuzosin 10mg sale
oxcarbazepine 600mg cost – cost levoxyl purchase levothroid without prescription
buy generic duphalac over the counter – cheap mentat generic buy betahistine without a prescription
chicken gamble is pure adrenaline: bet, cross, multiply, cash out — repeat! Four modes let you dial the risk from beginner-friendly to hardcore. The thrill of the unknown awaits!
Get lucky instantly with luckyland slots sign up bonus! Sign up and claim 7,777 Gold Coins plus 10 free Sweeps Coins—no strings. Enjoy top-tier slots with real prize redemptions!
FanDuel Casino is America’s #1 online casino, delivering non-stop thrills with ignition casino no deposit bonus , exclusive slots like Huff N’ Puff, and actual dealer action normal at your fingertips. Mod players grab 500 Extra Spins together with $40 in Casino Perk decent for depositing $10—bonus up to $1,000 disown on first-day closing losses. Province all Thrillionaires: accompany at present, vie with your approach, and upon every moment into epic wins!