For example
function fff(){
true && (return)
echo 1
}
fff
The output is 1.
Clearly the fff reaches till its end and that's why 1 is being printed. The point is that return is executed in a subshell as you have placed it inside parenthesis. You should have done
true && return
instead of
true && (return)
Anything placed inside () is executed using a subshell and after the commands in the subshell finishes the control is passed back to the function fff and the subsequent command echo 1 is executed in this case.
Below script will give you the right output
#!/bin/bash
function fff(){
true && return 255
echo 1
}
fff
echo $? # Will give you 255 as output
Mind that return value greater than 255 will be wrapped around ie you will get (value modulo 255) - 1. For example if you return 259 you will get 3 ie (259%255)-1.