add a file to teach basics
This commit is contained in:
parent
6c073b08f7
commit
a0645e029e
108
basics.md
Normal file
108
basics.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
Alright so you have installed the repository. Good job 🎉
|
||||||
|
now let's began with writing some code-?
|
||||||
|
|
||||||
|
**here's how to define a `variable`**
|
||||||
|
Variable names can be arbitrarily long
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
to **print** these, this is what you do
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
you can't use variables with these names-
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**wanna add subtract multiply divide differentiate exponent or any mathematical funtion?**
|
||||||
|
do it this way
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
also you can define if you want to use BODMAS or PEMDAS using **modules** like this
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**asking the user for input**
|
||||||
|
|
||||||
|
if you want a custom value for anything given by the user you can use this built in funtion to do so-
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**Comments**
|
||||||
|
|
||||||
|
as your programs gets bigger chances are you will have some trouble finding some code here and that - comments can fix that - you can write as much as comments as you want without it being excecuted like this
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
here are some **practice exercises** for you to get started with the basics
|
||||||
|
|
||||||
|
1. write a program to get an input from a user and welcome them
|
||||||
|
2. write a program to add 1+1
|
||||||
|
3. what will be the output of the following:
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**solutions:**
|
||||||
|
|
||||||
|
program 1-
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
program 2-
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
OR
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
output for program 3 -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
more features coming soon I hope you enjoyed using nocode!
|
Loading…
Reference in New Issue
Block a user