-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a file to teach basics #5162
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same reason as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alright wait I'll try and run some checks on divide and get bring out the changes soon - probably it's something with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. That's what I was thinking as well. Maybe if you |
||||||
``` | ||||||
|
||||||
|
||||||
|
||||||
``` | ||||||
|
||||||
**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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting undefined when I ran a division on
so I don't think it should be included in the operations.