Let's learn Aardvark
hg0428 (174)

Welcome to Aardvark, the language that has entranced programmers by its simplicity and amazingness for the last few days.

My goal is to by the end of this lesson have taught you the basics of the Aardvark language and get you on a course to become an amazing Aardvark developer.
In programming, you usually start with a Hello World program, but let's mix it up this time, lets start by learning how to write a program that takes the user's username as input and outputs a random welcome message. But first, we need to learn basic input and output.
This code will output This is my Aardvark program!:

output("This is my Aardvark program!")

You see, not that hard, now don't forget the quotes, it won't work right without them. Let's look at what this code does, output has parentheses, which means its a function, and then inside the quotes are the message that shows up on the screen. Hmm, I wonder if I can change what's in the quotes and it will change the message, lets try it:

output("This is a different message")

If you run that program you will see that it worked! Now let's learn how to take user input:

input("Enter your username: ")

If you run that code, you will see that it will give that message and then let you type in an answer. But how do we store that answer in our program? We use variables, variables store data for use later in the code. So if we add a = to the beginning of that then it will store the input in the variable a, lets try it:

a = input("Enter your username: ")

How do we know if it worked? Well, let's try to output the data inside a. Try this code:

a = input("Enter your username: ")
output(a)

When you output variables, you don't need those quotes. Let's run it. When we run it, it will ask for our username and then output what we typed in. We can already get their username, we still need the random welcome message, lets first start with just a welcome message. If we output "Welcome, " before we output what they typed in, it would say Welcome, plus their username. Let's try it:

a = input("Enter your username: ")
output("Welcome, ")
output(a)

It worked! Let's simplify it, just do "Welcome, " + a instead of doing it on separate lines. Try this:

a = input("Enter your username: ")
output("Welcome, " + a)

It worked! We now have our username input and our welcome message, but what about the random. How can we make it do something random?
In Aardvark, the tools module has some functions to help us do random stuff. But how do we include a module? Try this code:

#include tools

It makes all the functions in the tools module available in our program, lets add it to our code:

#include tools
a = input("Enter your username: ")
output("Welcome, " + a)

Now, what is the function to do random stuff? In Aardvark, you can use the randomchoice function from the tools module to make random choices. randomchoice takes a list of possible choices as its one argument. How do we make a list in Aardvark? Just put it in between [ and ] and separate the items by commas. Let's try this code:

#include tools
username = input("Enter your username: ")
message = randomchoice("Welcome, ", "Hello, ", "Have a good day, ")
output(message + username)

It worked! We have reached our goal!

If you would like to continue learning Aardvark, watch for future tutorials, or go to our website.

You are viewing a single comment. View All
CodingCactus (3208)

pythonCode.replace('print', 'output').replace('import', '#include')
That's what I'm seeing

CodingCactus (3208)

@hg0428 sorry but you aren't allowed to have ads on repl.it hosted sites. Also what is that margin!!?? SO MUCH WHITESPACE! Also the text isn't in the center of the screen lmao. And two scroll bars???

hg0428 (174)

What ad? What do you mean the text is not at the center?
@CodingCactus

CodingCactus (3208)

@hg0428 don't bully the handwriting

hg0428 (174)

We did not add the ads, that is an iframe. @CodingCactus

hg0428 (174)

In an iframe.
It will be fixed as soon as we can.
@CodingCactus

CodingCactus (3208)

@hg0428 I don't care what html tag it is, it is still advertising something

hg0428 (174)

It will be fixed as soon as possible. @CodingCactus

hg0428 (174)

Plus, the add was already there before we even made the website, we did not put any ads on [email protected]

CodingCactus (3208)

@hg0428 how do you make a website and not realise you have put ads on it?

hg0428 (174)

It is just readthedocs.io in a frame.
readthedocs.io puts ads on their [email protected]

CodingCactus (3208)

@hg0428 make your own website lmao

hg0428 (174)

Just not yet.
I told you we will fix it soon.
@CodingCactus

PlasDev (6)

@CodingCactus if you have money for a domain, and hosting we will be happy to take it :) otherwise get off our back about getting a website lol.

HahaYes (1286)

@PlasDev mate cactus is a mod. He's gonna ban you

HahaYes (1286)

@PlasDev bro ads are not allowed on a repl domain.

hg0428 (174)

We did not put any ads on it.
@HahaYes

hg0428 (174)

We did not put any ads on it.
@HahaYes

hg0428 (174)

If you want, you can pay to remove ads.
@CodingCactus

hg0428 (174)

Are you going to report us for using readthedocs.io?
@CodingCactus

PlasDev (6)

@HahaYes @CodingCactus In all honesty idk what the practice is, I just heard about langjam, and started using it. We aren't doing it on purpose, it just happens that we use RTD so we get ads

hg0428 (174)

We can get banned for using readthedocs.io?
@HahaYes

CodingCactus (3208)

@hg0428 bruh I'm not paying anything, just make your own website, its easy

HahaYes (1286)

@hg0428 you're not gonna get us to pay. Move your ads somewhere else.

CodingCactus (3208)

@HahaYes hey just calm it down it a bit, there was clearly just a misunderstanding.

hg0428 (174)

Yes, you did misunderstand. Thank you for admitting.
@CodingCactus

HahaYes (1286)

@hg0428 oh boy this man has a big ego.

hg0428 (174)

They are from readthedocs.io
That is the website that hosts our docs
@HahaYes

HahaYes (1286)

@hg0428 uh quick question... are you 13?

PlasDev (6)

@HahaYes (i am older than that)

HahaYes (1286)

@PlasDev well by the egos I assume 11

CodingCactus (3208)

@hg0428 ok, so the website you are using to host the docs put the ads on there. So, maybe, why don't you make your own website?

hg0428 (174)

We are working on it, it could take a [email protected]

PlasDev (6)

@HahaYes What ego? Just chill out man. Stop bickering like (ironically) 4 year olds. Starting drama is just painful for everyone. You're just being a hypocrite.

CodingCactus (3208)

@PlasDev hi your data type section is empty

PlasDev (6)

@CodingCactus :O, lol sorry will work on that. Glad you're reading the docs!

CodingCactus (3208)

@PlasDev i'm transferring them to a website without ads for you.

PlasDev (6)

@CodingCactus Thanks! Sorry, ive just been at school all day :p

CodingCactus (3208)

@PlasDev hi, here you go https://aardvark-docs.codingcactus.repl.co/
Obviously change the css and stuff if you want. I might try to add a sidebar to navigate tomorrow if you want.

(repl to fork: https://repl.it/@CodingCactus/Aardvark-docs)

HahaYes (1286)

@PlasDev Bois I'm the biggest hypocrite you'll ever find

hg0428 (174)

Are we still able to easily add to it with markdown?
It doesn't matter, I am just [email protected]

CodeLongAndPros (1535)

@hg0428 Uh can't you use Sphinx to make HTML docs?