Conditional Operator in C - Programming in Sinhala | RAVB
පලවෙනි විනාඩි කිහිපයේ මම කියලා දෙන්නේ කලින් පාඩමට අදාල ප්රශ්ණයක් ගැන. ඔයාලට කැමති නම් අද පාඩම පටන් ගන්න තැනට වෙනකම් skip කරන්න පුළුවන් 4:08 In Sinhala : අද video එකෙන් මම කරන්නේ C language එකේ තියෙන conditional operator එක ගැන.ඉතින් conditional operator එක කියන්නෙ if else එක වගේ එකක්ම තමයි, හැබැයි අපිට පුළුවන් conditional operator එක use කරලා if else එකෙන් lines 4ක වගේ ලියන code එක තනි line එකකින් ලියන්න. conditioal operator එක use කරන්න කලින් දේවල් 3ක් දැනගන්න ඕනේ. ඒ තමයි, 1. condition එක 2. value එකක් ඕනෙ condition එක true වුනහම execute වෙන්න 3. value එකක් ඕනෙ condition එක false වුනහම execute වෙන්න ඉතින් conditional operator එක use කරන කොට ඔයා මුලින්ම condition එක දෙන්න ඕනෙ. condition එක program එකට දෙන්න ඕනෙ වරහන් 2ක් ඇතුලේ. condition එක දුන්නට පස්සේ අපි question mark(?) එකක් දෙනවා. ඊට පස්සේ(question mark එකට එහා පැත්තේ) අපි condition එක true වුනහම execute වෙන්න ඕනේ part එක question mark එකෙන් එහා පැත්තේ දෙනවා. ඊට පස්සේ අපි colen(:) එකක් දෙනවා ඒ value එකට එහා පැත්තේන්. colen එකෙන් එහා පැත්තේ අපි දෙනවා condition එක false වුනොත් execute වෙන්න ඕනෙ value එක. In English : In today's video, I'm going to teach you about the conditional operator in C language. The conditional operator works the same as if-else but it looks different. we have to use 4 or 5 lines to implement if we use if-else, but if we use conditional operator we can do the exact same thing in a single statement. In order to use conditional operator we have to give 3 things There are : 1. the condition 2. value that executes if the condition is true 3. value that executes if the condition is false Implementation of the conditional operator : In the conditional operator, you should give the condition first. Then you have to put a question mark(?) after the condition. After the question mark, you have to give a "value" that execute if the condition is true. And then you have to put a "colon(:)" after that value. Then you have to give a "value" right next to the colon(:) that execute if the condition is false. Eg : (condition) ? value that execute if the condition is true : value that execute if the condition is false Program files - https://drive.google.com/open?id=1kDIwmHIMknE_aQGWGUgJsfbITvQlVqEZ Follow me on : Facebook - https://www.facebook.com/ravbYT/ Twitter - https://twitter.com/AvbRusiru Instagram - https://www.instagram.com/ravb.abhisheak/
Download
0 formatsNo download links available.