Learning Julia —the simplest of beginnings

Learning Julia —the simplest of beginnings

How to do functions, for loops and conditionals — using FizzBuzz. In this post, we’ll create a function to solve the overly popular FizzBuzz programming challenge.

In this post, we’ll create a function to solve the overly popular FizzBuzz programming challenge.

By the end of this article, you will know:

  • How to create a function in Julia
  • How to do a for loop
  • How to create if-else blocks
  • What 1:5 means
  • How to calculate the remainder of a number when divided

This post is meant for beginner programmers or for those who never heard of Julia before. Don’t expect to do [earth-shattering massively parallel scientific workloads_](https://www.nextplatform.com/2017/11/28/julia-language-delivers-petascale-hpc-performance/) after reading this. Consider this as your humble beginnings in the awesome world of Julia._

What is FizzBuzz?

If you’ve never heard of it, FizzBuzz is a simple counting game, aiming to teach kids multiplicative tables. Participants gather around in a circle and someone starts counting from 1. The next person continues with 2 and so on, going around the circle. The trick is that if the number is divisible by 3, then instead of saying the number, the player should say Fizz. If the number is divisible by 5, then they should say Buzz. And if the number is divisible by both 3 and 5 then they should say FizzBuzz.

I guess you could play this game with any other 2 numbers, but 3 and 5 are the most popular choices.

This simple game has been translated to a programming challenge to torment beginner programmers. It also gives us a good chance to practice for loops and if statements in Julia. Let’s see how we can create a function that prints the solution for the first n numbers.

I’ve previously solved FizzBuzz in BigQuery, so if you’re interested in knowing how you can solve this using a PB scale data warehouse, check out my [article here_](https://towardsdatascience.com/fizzbuzz-in-bigquery-e0c4fbc1d195)._

Getting one step at a time

Instead of just running through the problem, let’s go step by step and see how we can tackle this problem.

What are we doing?

I find it quite important to have a** clear idea of what the function should achieve**. In our case, we want to print the first n numbers, but replacing numbers divisible by 3 with Fizz, 5 by Buzz and those that are divisible by both 3 and 5 (or 15 for you math geniuses out there) by FizzBuzz.

programming-languages programming loop julialang beginners-guide

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Guide to Python Programming Language

Guide to Python Programming Language

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Top 5 Programming Languages to Learn in 2021 | Top Programming Languages | Intellipaat

In this video, you will know the top 5 Programming languages to learn in 2021. It is always confusing for a beginner to choose a programming language from th...

Beginners Guide to Python, Part4: While Loops

True or False… While Loops Have Boolean Conditions?

The Definitive Guide To Choosing The Right Programming Language

It’s all about deciding what you want to create and what technology you want to work with. One of the hardest parts of becoming a programmer is simply deciding what programming language you should learn. There are so many to choose from! You become curious and next thing you know you’re learning nothing more than the syntax and some algorithms of like 5 different languages just to feel as lost as you were when you first starte