What is the difference between & and && operator, Please provide an example for it
& will check both the conditions even if the first one is false. Whereas,
&& will not check the second condition of the first one is false
If & will check both the conditions than what will be the output if first condition is true and second is flase. and if the output will be false than what is the purpose of using it over && operator.
(1==2) & (1==1) -> out put is false. Both conditions are evaluated
(1==1) & (3==3) -> out put is true. Both conditions are evaluated
(1==2) && (1==1) -> out put is false. Both conditions are evaluated
(1==2) && (3==3) -> out put is true. 1==2 is false. So it does not goes to 3==3 since one condition is false.. result will obviously be false
I believw it should be as folows:
(1==2) && (1==1) -> out put is false. First(not both) condition is evaluated
(1==2) && (3==3) -> out put is false(not true). 1==2 is false. So it does not goes to 3==3 since one condition is false.. result will obviously be false Am i right?
We offer online selenium and UFT/QTP training. The course is very comprehensive and covers every aspect of automation testing with UFT/QTP and selenium. All types of frameworks are covered in depth - data driven framework, hybrid framework, page object model with a live project
© 2020 Whizdom Trainings. All rights Reserved - Powered by Whizdom Trainings