Can you use this method to make nested if...else statements? It seems like you can, you just have to make another evaluating expression after the ':'. Or, am I wrong about this. The only thing I see is that it might get confusing.
Generally, Ternary operators are preferred over if-else as they just round-up the whole nested if-else code in just 1 statement, and are easy to understand / less complicated.
thank you and i'm really glad that my tutorials are helping you. try to watch the video's in 1080p. we have solved this problem in our latest video's but the issue still exists in some of our old video's and i'm really sorry about that. Keep Learning :)
Good tutorial, it helps a lot. But perhaps you could have a tutor for teaching you better English XD. Sorry no offense meant by it, but instead of saying "You are passed in exam" and "You are failed in exam", English speakers would say "You have passed the exam" and "You have failed the exam"
Imagine giving these tutorials in Hindi when your first language is English. That is the equivalent of what this guy is doing. Pretty amazing accomplishment, actually! :)
coral i think you are asking about using 2 or more variables to form the condition. Use the logical and comparison operators in the condition. use parenthesis to group it. example #include using namespace std; int main() { int mark, avg; cout 20) ? cout
I have gained more knowledge by watching your videos than referring books written by top Authors..!!Awesome Tutorials and keep doing the good WORK.!!
+Irfan Ali
happy to hear that.
Thank you :)
i did it #include
using namespace std;
int main()
{
int mark;
cout > mark;
mark >=35 ? cout
Thanks for it 😊
I watched all the videos in c++.... learned a lot...even have more clarity than before.... thanks a lot... good work.. God bless you
thank you.
keep learning :)
Watching this in 2020 and still it is the best tutorials that you can find online.
I really appreciate your lessons. You are excellent in teaching. Thanks for all the effort.
my pleasure.
keep learning :)
Great delivery.The first time I understood this concept of ternary very well.Keep the it up..
awesome.
keep learning :)
thank you ma dude. you finally helped me to figure out my homework.
my pleasure :)
Will you ever do an OpenGL tutorial series? The internet needs your teaching style for such an advanced topic!! :)
i'll try :)
I understand better by watching your posted video than study book
Therefore,i am very grateful to you.........
holy shit, im glad i found these tutorials. I hope to soon be a c++ master with your tutorials. thanks man!! did you go to school for this?
omg thanks m8 cheers!
1 question in my mind answered by watching this
It Is too good for understanding ❤❤❤❤❤
I love this dude! Keep up the good work!
+Cororo Lyune
thank you :)
thanks a lot anil thats a wonderful explaination
My pleasure :)
What if we have more than two conditions? like If, else if and else? could you please explain?
Reply 2
Sir, which software do you use to run these kind stuffs???
i'm using codeblocks ide
Hi when to use ternary over separate function? For example i have 3 different condition check in a function, can i use 3 ternary or 3 sub functions?
Only good for const veriables that need only two statements, you should still refer to (if else) conditions for clarity, readability and testing.
awesome....very helful plzz keep uploading such videos
Can ternary operator have nested form like in if-else operator ?
you can nest the ternary operator.
Thank you Sir .
Extraordinary work brother
thank you :)
Great video! Whats the name of the program you use to write cpp?
+Rectus Erectus
im using codeblocks ide :)
Thanks!
***** I am experiencing an issue with codeblocks. whenever I press build and run, it doesn't do anything.
+Rectus Erectus
what error you are getting????
did you installed codeblocks along with mingw or what???
+LearningLad
i mean to say did u get any warning etc????
thank u a lot
i got it from the first watch
most welcome :)
which editor do you use?
codeblocks ide
Can you use this method to make nested if...else statements? It seems like you can, you just have to make another evaluating expression after the ':'. Or, am I wrong about this. The only thing I see is that it might get confusing.
yes we can use them. you can avoid the confusion if you indent the code properly.
When would you recommend (or not) programmers to use ternary operators instead of the basic else-if statements?
+Cindy Yap The ternary operator does the work of a basic if-else in a single line making the code less complicated to understand.
which is more efficient to use...this one or if else?
Generally, Ternary operators are preferred over if-else as they just round-up the whole nested if-else code in just 1 statement, and are easy to understand / less complicated.
you r doing a good job...
i m too much week at prgrmng.. getting infrmations from u..
but here is a prblm i cant see the prgrame clearly...
thank you and i'm really glad that my tutorials are helping you.
try to watch the video's in 1080p.
we have solved this problem in our latest video's but the issue still exists in some of our old video's and i'm really sorry about that.
Keep Learning :)
my output screen is not holding in codeblocks..please tell me how to hold it??
you are the best !!!!
not yet :)
hey sir,, plzz explain if there is multiple ternary operator used in a program in the same line
hi
if i use for loops for getting several numbers,how can i use question mark?
Thx u so much
Pleasure :)
Bro can we use this in c
yes you can :)
Is it possible to nest the ternary operator ( Like nested ifs)??
If so can you please tell how to do it??
can we use && / || operator in expn ???????
(means Two conditions)
yes you can :)
Not using
Great 👍🏻
Thank you :)
hey :)
What if we have more than two conditions? like If, else if and else? could you please explain?
reply anil plzz
Use if - else if - else syntax
else is always last as elif is a second if
really awesome
what is" return 0"for
thanks man
Thank you so much
welcome :)
TYSM
most welcome :)
thank u so much sir :)
pleasure :)
Good video
THanks you so mcuh
ty
thanks
my pleasure :)
Thanks dude.
Syvmana
:)
Good tutorial, it helps a lot. But perhaps you could have a tutor for teaching you better English XD. Sorry no offense meant by it, but instead of saying "You are passed in exam" and "You are failed in exam", English speakers would say "You have passed the exam" and "You have failed the exam"
its ok.
i get it.
i'm working on it :)
Imagine giving these tutorials in Hindi when your first language is English. That is the equivalent of what this guy is doing. Pretty amazing accomplishment, actually! :)
Nyc class
Thank you sir
Welcome
shukria
Welcome
Thank you for the tutorials. You are awesome tutor.
my pleasure.
keep Learning :)
thanks thanks thaaaaanks
+Aseel Aseel
:-)
Thanks alot
Most welcome
Used ternary statement in cout
yes you can :)
n=100
n-95?(n
thanks
but u should also help us understand other ways do the same thing with ternry operators
thanks brazar
how to use ternary operator for more than 2 variables :D
coral
i think you are asking about using 2 or more variables to form the condition.
Use the logical and comparison operators in the condition.
use parenthesis to group it.
example
#include
using namespace std;
int main()
{
int mark, avg;
cout 20) ? cout
thank you so much... that's what exactly I was looking for.... I always have problem with the parenthesis.... thanks again :)
coral :)
btw u can do // to write a comment
sir you are right but you are passed in exam is not correct grammer lol
i'm trying to improve.
English is my 3rd language :)
@@LearningLad You know three that's impressive. I want to learn a second one day.
awesome :)
//done
#include
using namespace std;
int main()
{
int mark;
cout > mark;
mark >=45 ? cout
thanku so much sir!!
Pleasure :)
thank you so much
my pleasure.
keep learning :)