'Trouble with for loop syntax in postgresql

We do not need a for-loop for this, but I am practicing it by outputting each salary of each employee in the company. I get an error.

DO
$$
DECLARE
pay REAL;
BEGIN
FOR pay IN SELECT salary FROM company
LOOP
RAISE NOTICE '%' , pay.salary
END LOOP;
END;
$$
LANGUAGE plpgsql;

The error message:

ERROR:  syntax error at or near "loop"
LINE 9: end loop;
            ^
SQL state: 42601
Character: 109


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source