Language Comparison
Language Comparison
Language Comparison
SoftUni Team
Technical Trainers
Software University
https://softuni.org
Table of Contents
1. Execution Model
2. Variables
3. Data Types
4. Printing on the Console
5. Conditional Statements
6. Loops
7. Development Environments (IDE)
2
Have a Question?
sli.do
#
3
Execution Model
Compiler vs. Interpreter
Language Execution Model
▪ Compiled languages source
code
compiler machine execution
code
▪ Dynamically-typed languages
let n = 5; JS
perform type checking at runtime
n = "Hi"; // OK
▪ Examples: Python, JS, PHP
function f(n) { … }
▪ Combined typing: C#, TypeScript,
Objective-C, Dart, …
6
Variables
Declaring Variables in C#, Java, JS and Python
Declaring Variables in C# / Java
▪ To declare variable in C# / Java you need to use the pattern:
{data type} {variable name} = {value};
▪ C# ▪ Java
int firstNumber = 5; int firstNumber = 5;
string name = "Peter"; String name = "Peter";
bool isPassed = false; boolean isPassed = false;
char gender = 'F'; char gender = 'F';
double mathGrade = 5.49; double mathGrade = 5.49;
8
Declaring Variables in JavaScript
▪ To declare variable in JS you need to use the keyword let:
let {variable name} = {value};
▪ Examples:
let firstNumber = 5;
let name = "Peter";
let isPassed = false;
let mathGrade = 5.49;
9
Declaring Variables in Python
▪ Python has no keyword for declaring a variable
▪ Variables do not need to be declared with any particular type
▪ Examples of using variables in Python:
first_number = 5
name = "Peter"
is_passed = False
math_grade = 5.49
10
Data Types
Data Types in C#, Java, JS and Python
Primitive Data Types in C# and Java
▪ Built-in data types in C# ▪ Built-in data types in Java
▪ Integer – int, long ▪ Integer – int, long
▪ Real number – double, float ▪ Real number – double, float
▪ Text – string, char ▪ Text – String, char
▪ Boolean – boolean
▪ Boolean – bool
▪ Other – Object
▪ Other – object
int size = 50;
int size = 50; ((Object)size).getClass(
size.GetType() Int32 ) Integer
12
Data Types in JavaScript
▪ In JS data types are inferred from the values
▪ Not explicitly specified at variable declaration
▪ Primitive data types:
▪ number let size = 50;
▪ string typeof(size) number
▪ boolean let name = "Peter";
typeof(name) string
▪ object
let arr = [3, 5, 8];
▪ null
typeof(arr) object
▪ undefined
13
Data Types in Python
▪ In Python variables keep values of certain type
▪ The data type is inferred from the value
▪ Built-in data types in Python:
▪ int size = 50;
▪ float type(size) int
name = "Peter"
▪ str
type(name) str
▪ boolean values = [2, 3, 4]
▪ list type(values) list
14
Printing on the Console
Printing Data in C#, Java, JS and Python
Printing on the Console in C#
▪ Printing content and then going to a new line
Console.WriteLine("Peter");
21
If-Else in JavaScript and Python
▪ If-Else in JavaScript ▪ If-Else in Python
let grade = 4.50; grade = 4.50
if (grade >= 3.00) { if grade >= 3.00:
console.log("Passed!"); print("Passed!")
} else { else:
console.log("Failed!"); print("Failed!")
}
22
Loops
Loops in C#, Java, JS and Python
While Loop in C# and Java
▪ While loop in C# ▪ While loop in Java
int counter = 0; int counter = 0;
while (counter <= 9) while (counter <= 9) {
{ System.out.println(counter);
Console.WriteLine(counter); counter++;
counter++; }
}
24
While Loop in JS and Python
▪ While loop in JS ▪ While loop in Python
let counter = 0; counter = 0
while (counter <= 9) { while counter <= 9:
console.log(counter); print(counter)
counter++; counter += 1
}
25
For Loop in C# and Java
▪ For-loop in C#
for (int i = 0; i <= 9; i++)
{
Console.WriteLine(i);
}
▪ For-loop in Java
for (int i = 0; i <= 9; i++) {
System.out.println(i);
}
26
For Loop in JS and Python
▪ For-loop in JS
for (let i = 0; i <= 9; i++) {
console.log(i);
}
▪ For-loop in Python
for i in range(0, 10):
print(x)
27
IDE
Integrated Development Environments
Most Popular IDE for C#
Visual Studio
29
Most Popular IDE for Java
IntelliJ IDEA
30
Most Popular IDE for JavaScript
31
Most Popular IDE for Python
PyCharm
32
Universal Online IDEs
REPL.it
Online IDE for C#, Java, JS, Python and many others
33
Questions?
© SoftUni Global – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
SoftUni Diamond Partners
Educational Partners
36
Trainings @ Software University (SoftUni)
▪ Software University – High-Quality Education,
Profession and Job for Software Developers
▪ softuni.bg
▪ Software University @ Facebook
▪ facebook.com/SoftwareUniversity
▪ SoftUni Global
▪ softuni.org
37
License
▪ This course (slides, examples, demos, exercises, homework,
documents, videos and other assets) is copyrighted content
▪ Unauthorized copy, reproduction or use is illegal
▪ © SoftUni – https://about.softuni.bg/
▪ © Software University – https://softuni.bg
▪ © SoftUni Global – https://softuni.org
38