Ternary the magical operator is a very useful tool while you need to code frequently .....it enables you to work more frequently while you need to push a value on a variable depending upon the evaluation of any condition
condition ? 'value1' : 'value2'
if the condition evaluates to be true then the outcome of the above line will be 'value1' else value2....
until now i know your mind must be striking to say ohhhh i can do this with then if ...else logic
but my friend i will love to say just taste it once and u will definitely become the fan of it's spice.......
very recently i was looking at some work done by my seniors..where i could see the really intense and smart utilization of this amazing tool........
condition ? 'value1' : 'value2'
if the condition evaluates to be true then the outcome of the above line will be 'value1' else value2....
until now i know your mind must be striking to say ohhhh i can do this with then if ...else logic
but my friend i will love to say just taste it once and u will definitely become the fan of it's spice.......
very recently i was looking at some work done by my seniors..where i could see the really intense and smart utilization of this amazing tool........
No comments:
Post a Comment