Lesson 5 of 23

if, else, else if

8 min 25 XP

Condition true ആകുമ്പോൾ മാത്രം if കോഡ് പ്രവർത്തിപ്പിക്കുന്നു. കൂടുതൽ തിരഞ്ഞെടുപ്പുകൾക്ക് else if, ബാക്കി എല്ലാത്തിനും else. C-യിൽ 0 എന്നാൽ false, ഏത് non-zero value-ഉം true.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

if (x = 5) x-ൽ 5 സൂക്ഷിക്കുന്നു, എപ്പോഴും true ആണ്! താരതമ്യത്തിന് == ഉപയോഗിക്കൂ. ഈ bug C-യിലെ ഒരു ക്ലാസിക് കെണിയാണ്.

Challenge

+25 XP

ഒരു സംഖ്യ വായിക്കൂ. "Positive", "Negative" അല്ലെങ്കിൽ "Zero" print ചെയ്യൂ.

Output Loading C (first time takes a few seconds)
Press Run to see the result here.