Learn to Code via Tutorials on Repl.it!

← Back to all posts
LEARN MY LANGUAGE NOW #2!
[deleted]

# WELCOME TO Z-LANG TUTORIAL #2

i made the #2 one but i need to make this better

So what do we need to learn today?

• str and int
• imports
• inputs
• make a calcualtor!

YAY!

let's start

# Inputs

inputs are very simple in z-lang:

``make name = input("What is your name? ")``

Yea it's simple so that's good!

# str and int

str and int are for our calculator today
like we can write:

``````make num = int(input("Enter a number: "))
line(str(num))``````

and the output will be the number that you wrote

### But...

if you wrote a string, it will return an ERROR ERROR!
lol

# Imports

In our calc... we should import math in this project

## Why?

Because if we write this:

``line(num1 + num2)``

it will return the number to be like this
i mean if num1 is 5 and num2 us 1332 the number will be 51332

## So...

we need to IMPORT!

like this:

``download math``

here we imported the math library,
or in my language it is a BAG!

so we can use this:

``````download math
line(num1 + plus + num2)
\$or\$
\$or\$
line(num1 + div + num2)
\$or\$
line(num1 + multi + num2)``````

WOW!

# Let's build the calc!

So i'll make my own calc, write in comments your own calc or the same!

``````download math
make num1 = int(input("First number: "))
make num2 = int(input("Second number: "))
make op = input("Operator: ")

if op is "+" = {
line(num1 + plus + num2)
} else if op is "-" = {
} else if op is "/" = {
line(num1 + div + num2)
} else if op is "/" = {
line(num1 + multi + num2)
} else = {
line("INVALID OPERATOR!")
}``````

### I hope you enjoy!

CSharpIsGud (418)

I need to make a tutorial on how to make a true parser

[deleted]

@CSharpIsGud WOW!
gimme the link when you finish

I think u should change the take_input to input(cuz well take_input don't work as u should know)

RaidTheWeb (56)

I am working on a language to it is actually quite good.

[deleted]

@Bookie0 hey bookie
do you have an idea for a collab?

Bookie0 (3241)

Hey, sorry rn this weekend I’m pretty occupied, but maybe later this week @Zuhdi28 :]

[deleted]

@Bookie0 k, np
but i asked you for ideas, not to do now!

Bookie0 (3241)

Ah ok maybe a game, or a funny website... idk @Zuhdi28

[deleted]

@Bookie0 oh, ok, think about more ideas later
BYE!
have a good day!