A new learning way for neural network (NN) in which its weights can be optimized by using the ant colony algorithm is presented in this paper. The learning of neural network belongs to continuous optimization. The ant colony algorithm is initially developed for hard combinatorial optimization. A kind of ant colony optimization (ACO) for continuous optimization, which includes global searching, local searching and definite searching, is developed based on the basic ant colony algorithm. A three-layer neural network, as an example, is trained to express nonlinear function. The efficiency of the new algorithm is examinated. It is found that the new developed method has the merits of both ant colony algorithm and neural network.