what is Control Flow in Julia

what is Control Flow in Julia

Recipe Objective

This recipe explains what is control flow in julia.

Access Face Recognition Project Code using Facenet in Python

Control Flow

Julia provides us several control flow constructs:
Compound Expressions
Conditional Evaluation
Short-Circuit Evaluation
Repeated Evaluation
Exception Handling
Tasks (aka Coroutines)

c = begin
       a = 5
       b = 4
       a - b
    end
c = (a = 5; b = 4; a - b)

function test(a, b)
       if a > b
          println("a is greater than b")
       elseif a < b
          println("a is less than b")
       else
          println("a is equal to b")
       end
    end
test(4, 5)
test(5, 4)
test(5, 5)

f1(a) = (println(a); true)
f2(a) = (println(a); false)
f1(1) && f2(2)
f1(1) || f2(2)
for i = 1:5
       if i % 2 == 0
          continue
       end
       println(i)
    end

sqrt(-5)

What Users are saying..

profile image

Abhinav Agarwal

Graduate Student at Northwestern University
linkedin profile url

I come from Northwestern University, which is ranked 9th in the US. Although the high-quality academics at school taught me all the basics I needed, obtaining practical experience was a challenge.... Read More

Relevant Projects

MLOps using Azure Devops to Deploy a Classification Model
In this MLOps Azure project, you will learn how to deploy a classification machine learning model to predict the customer's license status on Azure through scalable CI/CD ML pipelines.

Deep Learning Project for Beginners with Source Code Part 1
Learn to implement deep neural networks in Python .

Recommender System Machine Learning Project for Beginners-3
Content Based Recommender System Project - Building a Content-Based Product Recommender App with Streamlit

Build a Autoregressive and Moving Average Time Series Model
In this time series project, you will learn to build Autoregressive and Moving Average Time Series Models to forecast future readings, optimize performance, and harness the power of predictive analytics for sensor data.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

Azure Text Analytics for Medical Search Engine Deployment
Microsoft Azure Project - Use Azure text analytics cognitive service to deploy a machine learning model into Azure Databricks

CycleGAN Implementation for Image-To-Image Translation
In this GAN Deep Learning Project, you will learn how to build an image to image translation model in PyTorch with Cycle GAN.

NLP Project for Beginners on Text Processing and Classification
This Project Explains the Basic Text Preprocessing and How to Build a Classification Model in Python

Deploy Transformer BART Model for Text summarization on GCP
Learn to Deploy a Machine Learning Model for the Abstractive Text Summarization on Google Cloud Platform (GCP)

MLOps Project for a Mask R-CNN on GCP using uWSGI Flask
MLOps on GCP - Solved end-to-end MLOps Project to deploy a Mask RCNN Model for Image Segmentation as a Web Application using uWSGI Flask, Docker, and TensorFlow.