Ad space (banner)
๐ŸŸฃJulia Lessons
Lesson 3 / 68

Using variables

This lesson covers the basics of using variables in Julia, with the aim of understanding string interpolation.

A variable is like a labelled box that stores a value under a name. Julia needs no type declaration — you simply write name = "value". Inside a string, $(variableName) embeds the value.

The sample code declares two variables, name = "Alice" and age = 14, and embeds them with the interpolation "Hello, $(name)! You are $(age) years old". Interpolation with $ is Julia's concise idiom.

A common early stumble is Julia's flexible type system — dynamically typed, yet types can be stated explicitly. You write quickly without them and add them where performance matters.

In professional work, that flexibility is what lets scientific code stay readable while running fast.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Julia directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)