Menu
Coddy logo textTech

Hello World!

Part of the Fundamentals section of Coddy's Lua journey — lesson 2 of 90.

The print() function takes whatever you put inside the parentheses and displays it as output. When you want to display text, you need to wrap it in quotes to create what's called a string.

Here's the basic syntax:

print("Your text here")

You can use either double quotes " or single quotes ' around your text - both work the same way in Lua.

The traditional first program that every programmer writes is called "Hello World!" and it looks like this:

print("Hello World!")

When you run this code, you'll see the exact text Hello World! appear in the output area. This simple program demonstrates the fundamental concept of producing output in any programming language.

challenge icon

Challenge

Easy

Use the code view to write a program that outputs

Hello World!

Note that anything inside quotation marks is case sensitive. For example:

print("Hello World!")
print("hello world!")

are different things (notice the capital letters in the first line).

Cheat sheet

To display text in Lua, use the print() function with the text wrapped in quotes to create a string:

print("Your text here")

You can use either double quotes " or single quotes ' around your text:

print("Hello World!")
print('Hello World!')

Text inside quotation marks is case sensitive.

Try it yourself

-- TODO: Write your code here
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals