#example bitwise operator vs lazy operator a= c(1,1) b= c(1,3) d= c(2,1) a==1 & b==1 #it evaluates all positions a==1 && b==1 #it evaluates only the first position a==1 && d==1 #it evaluates only the first position a==1 || z==1 #it evaluates only what is necessary a==1 | z==1 #it evaluates all myfunif=function(){ if (a==1 && b==1) { cat("True\n") } else{ cat("False\n") } } myfunif() myfunif1=function(){ if (a==1 & b==1) { cat("True\n") } else{ cat("False\n") } } myfunif1()