ssh use of error codes

I want to import the info to shell when the connection to remote host was closed . I have follwed by ssh errors but how to use variables in script.
I am thinking out loud the shell script could look as follow:

svnvaraible=$ERROR_SSH_CONNECTION_LOST 
if [$svnvaraible=110]; then 
break
fi

After executing "ssh", check its return code:

echo "ls -l" | ssh -C -l <user> <server>
sshRetCode=${?}
if [ ${sshRetCode} -eq 110 ]
then
      break
fi

A list of SSH return codes can be found here (to some unixs): SSH and SCP Return Codes - Tech Note 2116