Home »
Julia
Printing in Julia programming language
Julia | printing: In this tutorial, we are going to learn how to print text/values/variable's values in Julia programming language?
Submitted by IncludeHelp, on March 27, 2020
In all programming languages – printing is the most importing step, where we print the text on the screen/console. Printing is done by predefined functions/methods.
In Julia language – we use the print() and println() functions to print the text on the screen.
The print() and println() functions
The print() and println() functions are used to print the string representation of an object, they can be used to print any text/string, value, variable’s value on the string. We can also use the string concatenation technique to print multiple things (like other programming languages).
The difference between print() and println() is that, print() does not include a newline after the printed text while println() includes a newline.
Example 1:
print("Hello, world!")
println("Hello, IncludeHelp")
print(10+20)
println("Julia is a programming language")
Output
Hello, world!Hello, IncludeHelp
30Julia is a programming language
Example 2:
# printing the text
println("Hello World!")
println("Hello IncludeHelp!")
# string concatenation
println("Hello", " ", "World!")
println("Hello", " ", "IncludeHelp!")
# printing values
println(10)
println(10.23)
println(-1234.56)
# printing variables
x = 10
println(x)
println(x+1)
println(x+10)
println(x+x)
x = 10
println("x: ", x)
println("x+1: ", x+1)
println("x+10: ", x+10)
println("x+x: ", x+x)
Output
Hello World!
Hello IncludeHelp!
Hello World!
Hello IncludeHelp!
10
10.23
-1234.56
10
11
20
20
x: 10
x+1: 11
x+10: 20
x+x: 20