Of course you will lose weight if you don't eat, but it is a very unhealthy way to diet. There are dangers, you still need certain vitamins and nutrients. The human body can only go so long without food before serious problems arise, even death. When you deprive your body of food it slows down your metabolism to a slow crawl to conserve as much energy as possible. Without food for energy your body will breakdown stored fat, but will also breakdown muscle tissue for energy.
When it is all said and done and you go back to eating again your body will be in starvation mode and store every extra calorie it can get. For this reason, people who have been on starvation diets and crash diets gain weight rapidly when they start eating normally.
Be kind to your body, don't starve it. Weight loss can be achieved with a healthy diet and regular exercise and these lifestyle changes can last a lifetime, not just a couple of weeks.
A proper diet along with exercise is the best way to lose weight.