© Antonello Lobianco 2019
A. LobiancoJulia Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-5190-4_3

3. Control Flow and Functions

Antonello Lobianco1 
(1)
Nancy, France
 

Now that you’ve been introduced to the main types and containers available in Julia, it is time to put them to work.

3.1 Code Block Structure and Variable Scope

All the typical flow-control constructs (for, while, if/else, and do) are supported. The syntax typically takes this form:
<keyword> <condition>      JULIA
    ... block content...
end
For example:
for i in 1:5      JULIA
    println(i)
end

Note that parentheses around the condition are not necessary, and the block ends with the keyword end.

Variable Scope

Note that within a block the visibility of a variable changes, and Julia ...

Get Julia Quick Syntax Reference: A Pocket Guide for Data Science Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.