Learning is essential for cognitive robots as humans to gain experience and to adapt to the real world. We propose an experiential learning method for robots to build their experience online and to transfer knowledge among appropriate contexts. Experience gained through learning is used as a guide to future decisions of the robot for both efficiency and robustness. We use Inductive Logic Programming (ILP) learning paradigm to frame hypotheses represented in first-order logic that are useful for further reasoning and planning processes. Furthermore, incorporation of background knowledge is also possible to generalize the framed hypotheses. Partially specified world states can also be easily represented by these hypotheses. All these advantages of ILP make this approach superior to the other supervised learning methods. We have analyzed the performance of the learning method on our autonomous mobile robot and on our robot arm both building their experience on action executions online. It has been observed in both domains that our experience-based learning and learning-based guidance methods frame sound hypotheses that are useful for constraining and guiding the future tasks of the robots. This learning paradigm is promising especially for the contexts where abstraction is useful for efficient transfer of knowledge.