Julia Program While Loop

Today i trying to execute while loop in Julia

Julia is a  Open Source.Julia is free for everyone to use..Julia is a high-level general-purpose dynamic programming language that is designed to address the needs of high-performance numerical analysis and computational science, without the need of separate compilation to be fast.


Julia is used in

  • Machine Learning
  • Data Science
  • Visualisation
  • General Purpose
  • Parallel Computing
  • Scientific Domains


While Loop  to print even number between 2 to 10 .

 To print the even number we will first declare a variable called as 'a' and assign a value as two. This is very simple just declare as follow a=2;

In the next line we will create a while loop.

while a <10
        if(a%2 == 0)
          println(a)
        end
        global a=a+1
        end

here we are checking by using if condition , if the number is divisible by 2 then it is even number. Lets execute the script and see




Output : 
2
4
6
8



Next :  Main Menu


Comments