Your first program
Save the following as hello.j:
# hello.j
use io;
def x as int init 21;
io.printf($x + $x);
Run it:
./jennifer run hello.j
You should see 42.
What just happened
use io;makes Jennifer’s standard library functions available.def x as int init 21;declares an integer variable namedxand initializes it to21. Notice that using a variable requires the$prefix.io.printf($x + $x)calls the standard library function with the result of21 + 21.
Top-level statements run in source order - there is no required entry-point
method. You can still group reusable code into methods (def) and call them
explicitly.