I want to know if i can add two different custom post types to my wordpress site

I’m trying to add two custom post types, “articles” and “projects”. Using a php code i found on wpbeginner, “articles” post has worked. But when I’m trying the same code with “projects” i’m getting a code error.

Your PHP code changes were rolled back due to an error on line 70 of
file wp-content/themes/generatepress-child/functions.php. Please fix
and try saving again.

Cannot redeclare create_posttype() (previously declared in
wp-content/themes/generatepress-child/functions.php:34)