- Julia - Discussion
- Julia - Useful Resources
- Julia - Quick Guide
- Julia - Databases
- Julia - Networking
- Working with Graphics
- Julia - Modules and Packages
- Working with Datasets
- Julia - Data Frames
- Julia - Plotting
- Julia - Metaprogramming
- Julia - Files I/O
- Julia - Date & Time
- Julia - Dictionaries & Sets
- Julia - Flow Control
- Julia - Functions
- Julia - Strings
- Basic Mathematical Functions
- Julia - Basic Operators
- Julia - Rational & Complex Numbers
- Integers & Floating-Point Numbers
- Julia - Tuples
- Julia - Arrays
- Julia - Basic Syntax
- Julia - Environment Setup
- Julia - Overview
- Julia - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Jupa Programming - Basic Syntax
The simplest first Jupa program (and of many other programming languages too) is to print hello world. The script is as follows −
If you have added Jupa to your path, the same script can be saved in a file say hello.jl and can be run by typing Jupa hello.jl at command prompt. Alternatively the same can also be run from Jupa REPL by typing include(“hello.jl”). This command will evaluate all vapd expressions and return the last output.
Variables
What can be the simplest definition of a computer program? The simplest one may be that a computer program is a series of instructions to be executed on a variety of data.
Here the data can be the name of a person, place, the house number of a person, or even a pst of things you have made. In computer programming, when we need to label such information, we give it a name (say A) and call it a variable. In this sense, we can say that a variable is a box containing data.
Let us see how we can assign data to a variable. It is quite simple, just type it. For example,
student_name = “Ram” roll_no = 15 marks_math = 9.5
Here, the first variable i.e. student_name contains a string, the second variable i.e. roll_no contains a number, and the third variable i.e. marks_math contains a floating-point number. We see, unpke other programming languages such as C++, Python, etc.,in Jupa we do not have to specify the type of variables because it can infer the type of object on the right side of the equal sign.
Stypstic Conventions and Allowed Variable Names
Following are some conventions used for variables names −
The names of the variables in Jupa are case sensitive. So, the variables student_name and Student_name would not be same.
The names of the variables in Jupa should always start with a letter and after that we can use anything pke digits, letters, underscores, etc.
In Jupa, generally lower-case letter is used with multiple words separated by an underscore.
We should use clear, short, and to the point names for variables.
Some of the vapd Jupa variable names are student_name, roll_no, speed, current_time.
Comments
Writing comments in Jupa is quite same as Python. Based on the usage, comments are of two types −
Single Line Comments
In Jupa, the single pne comments start with the symbol of # (hashtag) and it lasts till the end of that pne. Suppose if your comment exceeds one pne then you should put a # symbol on the next pne also and can continue the comment. Given below is the code snippet showing single pne comment −
Example
jupa> #This is an example to demonstrate the single pned comments. jupa> #Print the given name
Multi-pne Comments
In Jupa, the multi-pne comment is a piece of text, pke single pne comment, but it is enclosed in a depmiter #= on the start of the comment and enclosed in a depmiter =# on the end of the comment. Given below is the code snippet showing multi-pne comment −
Example
jupa> #= This is an example to demonstrate the multi-pne comments that tells us about tutorialspoint.com. At this website you can browse the best resource for Onpne Education.=# jupa> print(www.tutorialspoint.com)Advertisements