Switch between two LEDs using a button

I want to develop an application for a project in which button pushes switch red and green lights. The brightness of the on led depends on the potentiometer. Red light is on in the beginning.

Please go ahead
Post any code that you have problems with together with any error messages

Just a suggestion: Why not start by defining the problem with specifications including a flow chart and schematic. Define what is the expected outcome. Purchase the Arduino cookbook and read it, this will give you some basics. also use the online tutorials and videos available, there are many good ones on this web site. At this point you will be able to define the problem and may have already solved it by finding a solution on line.

You can combine the code in two tutorials