Entering a code block in Squarespace is similar to any other Block content.
First enter your admin section and select the page you want to enter the code block onto. Select the black dot (circled in red) that brings up the content block and then scroll down to the Code </> Block and select.
The Code box will then appear on your page. Determine whether you are entering HTML or Java and select the relevant one.
Copy your code to your clipboard. Then highlight the Hello World section (to overwrite) or you can delete first. You will then need to paste you code in Note: Right click of mouse may not work. You will need to CTRL V (CMD V on MAC) to enter code, then save.
Your code should look something like the below.
To view click on View Page/Blog or visit the relevant page on your website.