The code in Figure 1 can be compiled and run.
Assuming that the program is stored in a file hello.v, compiling can be done as
iverilog -o hello hello.v
The above command generates the file hello, which can be run, by doing
which results in the printout