Extract the source and destination address from the frame, and find the corresponding table entries for each address. If the two table entries point to the same interface, discard the frame. Otherwise, if the two pointers are different, send the frame out on the LAN given by the routing entry for the destination address. We don't know where the destination is, so let's be conservative and send it everywhere. That way we can be sure that the packet traverses the LAN on which the destination resides.
Bridges use backward learning to build tables.
They determine which LAN to use to reach destination X by recording the interface on which frames having source address X arrive on. The above approach works only for tree-structured topologies. That is, they are specifically excluded from the tree and do not forward packets. They are available for backup, however, should one of the other bridges or LANs fail. Bridges periodically rebuild tables.