Skip to content

Starting Out

RedstoneBoy0509 edited this page Jun 1, 2021 · 3 revisions

Starting Out with JavaEZ

This is assuming that you have JavaEZ installed in some way. If not, follow the Startup Guide

The Core Extension

Let's start by importing the Core extension. Paste this code into the top of your file.

import static io.github.javaezlib.javaez.extensions.Core.*;

Now, move on to the next step.

Hello World!

Let's try and make the famous "Hello World!" program using the JavaEZ functions. Paste this code into your main function.

say("Hello World!");

Let's now try and run the code. Your console output should say: Hello World!

Variables

What if we wanted to save some information for later? This is where variables come in! Let's make our "Hello World!" program again, but using variables! Try:

set("test variable", "Hello World!");
say(get("test variable"));

Again, the output should say: Hello World!, but this time, we make a variable named "test variable" and set it to "Hello World!", then we call our say function again, but this time get our "test variable" and give it the text.

If this, if that

You can also run if statements to check if something is true or false. For instance,

doIf(1000 > 100, () -> {
   say("It's greater than 100!");
});

This would print "It's greater than 100!" because 1000 is greater than 100. You can also add an ELSE statement. Here is the code, but with an ELSE statement.

doIf(1000 > 100, () -> {
   say("It's greater than 100!");
}, () -> {
   say("NOT GREATER THAN 100");
});

Now, if you changed 1000 to something 100 or below, it would say "NOT GREATER THAN 100".

JavaEZ is a library to help newcomers learn or just for the quality of life. This wiki explains everything about how to install and use JavaEZ to your liking.

Clone this wiki locally