Keywords in Julia are reserved words that have a pre-defined meaning to the compiler. These keywords can’t be used as a variable name.
'end'
keyword in Julia is used to mark the end of a block of statements. This block can be of any type like struct, loop, conditional statement, module, etc.
Syntax:
block_type block_name
Statement
Statement
end
Example:
function fn()
for i in 1 : 5
if i % 2 = = 0
println(i, " is even" );
else
println(i, " is odd" );
end
end
end
fn()
|
Output:
1 is odd
2 is even
3 is odd
4 is even
5 is odd
Note: 'end'
can also be used to mark the last index in a 1D array.
Example:
Array1 = Array([ 1 , 2 , 3 , 4 , 5 ])
println( "Last element of Array: " , Array1[end])
|
Output:
Last element of Array: 5
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
26 Mar, 2020
Like Article
Save Article