├── .gitattributes ├── C++ └── HackerRank │ └── Elementary │ ├── 01. Hello World.cpp │ └── 02. Input and Output.cpp ├── Go └── golangr │ └── Beginner Exercises │ ├── 01. Hello World.go │ ├── 02. Comments.go │ ├── 03. Strings.go │ ├── 04. Keyboard Input.go │ ├── 05. Variables.go │ ├── 06. Scope.go │ ├── 07. Arrays.go │ ├── 08. For Loops.go │ ├── 09. Range.go │ ├── 10. If Statements.go │ └── 11. While Loops.go ├── Java └── Programiz │ └── First Steps In Coding │ ├── 01. Hello World.java │ ├── 02. Variables and Literals.java │ ├── 03. Data Types.java │ ├── 04. Operators.java │ ├── 05. Input and Output.java │ └── 06. Expressions and Blocks.java ├── LICENSE ├── Perl ├── First steps in coding │ └── GeeksForGeeks │ │ └── 01. Hello World.perl └── Regex │ └── Examples │ └── Perl Regex Email Validation Example │ └── 0.1 Example.perl ├── README.md ├── Ruby └── HackerRank │ ├── (1) First steps in Ruby │ ├── 01. Print Hello HackerRank.rb │ ├── 02. Everything is an object.rb │ ├── 03. Odd or Even.rb │ └── 04. a in range b, c.rb │ ├── (2) Enumerable │ ├── 01. collect.rb │ ├── 02. reduce.rb │ ├── 03. any, all, none and find.rb │ └── 04. Group By Marks.rb │ └── (3) Strings │ ├── 01. Encoding.rb │ ├── 02. Indexing.rb │ ├── 03. Iteration.rb │ ├── 04. Methods I.rb │ └── 05. Methods II.rb ├── SQL └── MySQL │ └── Database basics │ ├── 00. Full Code.sql │ ├── 01. Create Table.sql │ ├── 02. Insert Data.sql │ ├── 03. Find All Records.sql │ ├── 04. Find Last Name, Age and Grade.sql │ ├── 05. Find First 5 Records.sql │ ├── 06. Find First 5 Last Name and Grade.sql │ ├── 07. Truncate Table.sql │ └── 08. Drop Table.sql ├── Swift └── Programiz │ └── First Steps in Swift │ ├── 01. Hello, World.swift │ ├── 02. Variables.swift │ ├── 03. Data Types.swift │ ├── 04. Characters and Strings.swift │ ├── 05. Input and Output.swift │ ├── 06. Code blocks.swift │ ├── 07. Comments.swift │ └── 08. Optionals.swift └── TypeScript └── Utility Types ├── FirstCode.ts ├── SecondCode.ts └── ThirdCode.ts /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sql linguist-detectable=true -------------------------------------------------------------------------------- /C++/HackerRank/Elementary/01. Hello World.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | printf("Hello, World!"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /C++/HackerRank/Elementary/02. Input and Output.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | 9 | int main() { 10 | int a,b,c; 11 | cin >> a >> b >>c; 12 | cout << a+b+c; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/01. Hello World.go: -------------------------------------------------------------------------------- 1 | package main 2 | import "fmt" 3 | 4 | func main() { 5 | fmt.Printf("Hello, World!") 6 | } 7 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/02. Comments.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | /* multi line comment test 7 | Author: MitkoVtori */ 8 | fmt.Println("Go!") 9 | 10 | // Author: MitkoVtori 11 | fmt.Println("Lang!") 12 | } 13 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/03. Strings.go: -------------------------------------------------------------------------------- 1 | package main 2 | import ( 3 | "fmt" 4 | ) 5 | func main() { 6 | fmt.Printf("%d:%s", 2016, "year") 7 | } 8 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/04. Keyboard Input.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | ) 8 | 9 | func main() { 10 | reader := bufio.NewReader(os.Stdin) 11 | fmt.Print("Enter your city: ") 12 | city, _ := reader.ReadString('\n') 13 | fmt.Print("You live in " + city) 14 | } 15 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/05. Variables.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | apple := 3.0 7 | bread := 2.0 8 | price := apple + bread 9 | 10 | fmt.Printf("") 11 | fmt.Printf("Price: %f\n",price) 12 | vat := price * 0.15 13 | fmt.Printf("VAT: %f\n",vat) 14 | total := vat + price 15 | fmt.Printf("Total: %f\n",total) 16 | fmt.Printf("") 17 | } 18 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/06. Scope.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | var x = 7 6 | 7 | func example() { 8 | fmt.Println(x) 9 | } 10 | 11 | func main() { 12 | fmt.Println(x) 13 | example() 14 | } 15 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/07. Arrays.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | var arr1 = new([5]int) 7 | fmt.Println(arr1[2]) 8 | fmt.Println(arr1[3]) 9 | } 10 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/08. For Loops.go: -------------------------------------------------------------------------------- 1 | package main 2 | import ( 3 | "fmt" 4 | ) 5 | func main() { 6 | a := []int{1, 2, 3, 4, 5, 6} 7 | 8 | for i := 0; i < len(a); i = i +1 { 9 | fmt.Println("character :", a[i]) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/09. Range.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | nums := []int{1,2,3,4,5,6} 7 | 8 | for _, num := range nums { 9 | fmt.Println(num) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/10. If Statements.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | var x = 3 7 | 8 | if ( x > 2 ) { 9 | fmt.Printf("x is greater than 2"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Go/golangr/Beginner Exercises/11. While Loops.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | sum := 1 7 | 8 | for sum < 100 { 9 | sum += 5 10 | } 11 | fmt.Println(sum) 12 | } 13 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/01. Hello World.java: -------------------------------------------------------------------------------- 1 | class HelloWorld { 2 | public static void main(String[] args) { 3 | System.out.println("Hello, World!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/02. Variables and Literals.java: -------------------------------------------------------------------------------- 1 | class Main { 2 | public static void main(String[] args) { 3 | 4 | double myDouble = 3.4; 5 | float myFloat = 3.4F; 6 | 7 | double myDoubleScientific = 3.445e2; 8 | 9 | System.out.println(myDouble); 10 | System.out.println(myFloat); 11 | System.out.println(myDoubleScientific); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/03. Data Types.java: -------------------------------------------------------------------------------- 1 | class Main { 2 | public static void main(String[] args) { 3 | 4 | boolean flag = true; 5 | System.out.println(flag); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/04. Operators.java: -------------------------------------------------------------------------------- 1 | class Main { 2 | public static void main(String[] args) { 3 | 4 | // declare variables 5 | int a = 12, b = 5; 6 | 7 | // addition operator 8 | System.out.println("a + b = " + (a + b)); 9 | 10 | // subtraction operator 11 | System.out.println("a - b = " + (a - b)); 12 | 13 | // multiplication operator 14 | System.out.println("a * b = " + (a * b)); 15 | 16 | // division operator 17 | System.out.println("a / b = " + (a / b)); 18 | 19 | // modulo operator 20 | System.out.println("a % b = " + (a % b)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/05. Input and Output.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Input { 4 | public static void main(String[] args) { 5 | 6 | Scanner input = new Scanner(System.in); 7 | 8 | System.out.print("Enter an integer: "); 9 | int number = input.nextInt(); 10 | System.out.println("You entered " + number); 11 | 12 | input.close(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Java/Programiz/First Steps In Coding/06. Expressions and Blocks.java: -------------------------------------------------------------------------------- 1 | class Main { 2 | public static void main(String[] args) { 3 | 4 | String band = "Beatles"; 5 | 6 | if (band == "Beatles") { 7 | System.out.print("Hey "); 8 | System.out.print("Jude!"); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Dimitar Dimitrov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Perl/First steps in coding/GeeksForGeeks/01. Hello World.perl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | print("Hello World\n"); 7 | -------------------------------------------------------------------------------- /Perl/Regex/Examples/Perl Regex Email Validation Example/0.1 Example.perl: -------------------------------------------------------------------------------- 1 | /(?(DEFINE) 2 | (?
(?&mailbox) | (?&group)) 3 | (? (?&name_addr) | (?&addr_spec)) 4 | (? (?&display_name)? (?&angle_addr)) 5 | (? (?&CFWS)? < (?&addr_spec) > (?&CFWS)?) 6 | (? (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ; 7 | (?&CFWS)?) 8 | (? (?&phrase)) 9 | (? (?&mailbox) (?: , (?&mailbox))*) 10 | 11 | (? (?&local_part) \@ (?&domain)) 12 | (? (?&dot_atom) | (?"ed_string)) 13 | (? (?&dot_atom) | (?&domain_literal)) 14 | (? (?&CFWS)? \[ (?: (?&FWS)? (?&dcontent))* (?&FWS)? 15 | \] (?&CFWS)?) 16 | (? (?&dtext) | (?"ed_pair)) 17 | (? (?&NO_WS_CTL) | [\x21-\x5a\x5e-\x7e]) 18 | 19 | (? (?&ALPHA) | (?&DIGIT) | [!#\$%&'*+-/=?^_`{|}~]) 20 | (? (?&CFWS)? (?&atext)+ (?&CFWS)?) 21 | (? (?&CFWS)? (?&dot_atom_text) (?&CFWS)?) 22 | (? (?&atext)+ (?: \. (?&atext)+)*) 23 | 24 | (? [\x01-\x09\x0b\x0c\x0e-\x7f]) 25 | (? \\ (?&text)) 26 | 27 | (? (?&NO_WS_CTL) | [\x21\x23-\x5b\x5d-\x7e]) 28 | (? (?&qtext) | (?"ed_pair)) 29 | (? (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))* 30 | (?&FWS)? (?&DQUOTE) (?&CFWS)?) 31 | 32 | (? (?&atom) | (?"ed_string)) 33 | (? (?&word)+) 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fundamentals common 2 | Here, I'll post projects, solved problems & others on different languages, that I mainaly self learn. 3 | 4 | | SQL | Ruby | Swift | C++ | Go | Java | TypeScript | Perl | 5 | | ---------------- | ------------ | ------------ | -------------- | ------------ | ---------- | ---------- | ------ | 6 | | | | | | | | | | 7 | | MySQL | HackerRank | Programiz | HackerRank | golangr | Programiz | Utility Types | First steps in coding | 8 | | | | | | | | | | 9 | | Database basics | First Steps In Ruby | First Steps In Swift | Elementary | Beginner Exercises | First Steps In Coding | | GeeksForGeeks | 10 | | | | | | | | | | 11 | | | Enumerable | | | | | | Regex | 12 | | | | | | | | | | 13 | | | Strings | | | | | | Regex Examples | 14 | | | | | | | | | | 15 | | | | | | | | | Email Validation Regex Examples | 16 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(1) First steps in Ruby/01. Print Hello HackerRank.rb: -------------------------------------------------------------------------------- 1 | print "Hello HackerRank!!" 2 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(1) First steps in Ruby/02. Everything is an object.rb: -------------------------------------------------------------------------------- 1 | print self 2 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(1) First steps in Ruby/03. Odd or Even.rb: -------------------------------------------------------------------------------- 1 | def odd_or_even(number) 2 | return number.even? 3 | 4 | end 5 | 6 | (0...gets.to_i).each do |i| 7 | puts odd_or_even(gets.to_i) 8 | end 9 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(1) First steps in Ruby/04. a in range b, c.rb: -------------------------------------------------------------------------------- 1 | return a.range? b, c 2 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(2) Enumerable/01. collect.rb: -------------------------------------------------------------------------------- 1 | def rot13(secret_messages) 2 | secret_messages.map { |v| rotate13(v) } 3 | end 4 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(2) Enumerable/02. reduce.rb: -------------------------------------------------------------------------------- 1 | def sum_terms(n) 2 | (1..n).inject(0) {|sum, n| sum +(n*n+1)} 3 | end 4 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(2) Enumerable/03. any, all, none and find.rb: -------------------------------------------------------------------------------- 1 | def func_any(hash) 2 | hash.any?{|key,value| key.is_a? Integer} 3 | end 4 | 5 | def func_all(hash) 6 | hash.all?{|key,value| value.is_a? Integer and value < 10} 7 | end 8 | 9 | def func_none(hash) 10 | hash.none?{|key,value| value==nil} 11 | end 12 | 13 | def func_find(hash) 14 | hash.find{|key,value| (key.is_a? Integer and value.is_a? Integer and value < 20) or (key.is_a? String and value[0]=="a")} 15 | end 16 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(2) Enumerable/04. Group By Marks.rb: -------------------------------------------------------------------------------- 1 | def group_by_marks(marks, n) 2 | res = { "Failed" => [], "Passed" => [] } 3 | marks.group_by do |k, v| 4 | if v < n then 5 | res["Failed"].push([k, v]) 6 | else 7 | res["Passed"].push([k, v]) 8 | end 9 | end 10 | 11 | if res["Failed"].length == 0 then res.delete("Failed") end 12 | if res["Passed"].length == 0 then res.delete("Passed") end 13 | 14 | return res 15 | end 16 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(3) Strings/01. Encoding.rb: -------------------------------------------------------------------------------- 1 | def transcode(string) 2 | new_string = string.force_encoding(Encoding::UTF_8) 3 | return new_string 4 | end 5 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(3) Strings/02. Indexing.rb: -------------------------------------------------------------------------------- 1 | def serial_average(code) 2 | code = code.split('-') 3 | average = ((code[1].to_f + code[2].to_f)/2.0).round(2) 4 | return code[0] + "-" + average.to_s 5 | end 6 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(3) Strings/03. Iteration.rb: -------------------------------------------------------------------------------- 1 | def count_multibyte_char(code) 2 | counter = 0 3 | code.each_char{c counter += 1 if c.bytesize 1} 4 | return counter 5 | end 6 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(3) Strings/04. Methods I.rb: -------------------------------------------------------------------------------- 1 | def process_text(arr) 2 | arr.each { |x| x.strip! } 3 | arr.join(" ") 4 | end 5 | -------------------------------------------------------------------------------- /Ruby/HackerRank/(3) Strings/05. Methods II.rb: -------------------------------------------------------------------------------- 1 | def strike(text) 2 | return "#{text}" 3 | end 4 | 5 | def mask_article(s,texts) 6 | texts.each do |text| 7 | s.gsub!(text, strike(text)) 8 | end 9 | s 10 | end 11 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/00. Full Code.sql: -------------------------------------------------------------------------------- 1 | USE `database_name`; 2 | 3 | 4 | CREATE TABLE `students` ( 5 | `id` INT AUTO_INCREMENT PRIMARY KEY, 6 | `first_name` VARCHAR(50), 7 | `last_name` VARCHAR(50), 8 | `age` INT, 9 | `grade` DOUBLE 10 | ); 11 | 12 | 13 | INSERT INTO `students` (`id`, `first_name`, `last_name`, `age`, `grade`) 14 | VALUES 15 | (1, 'Guy', 'Gilbert', 15, 4.5), 16 | (2, 'Kevin', 'Brown', 17, 5.4), 17 | (3, 'Roberto', 'Tamburello', 19, 6), 18 | (4, 'Linda', 'Smith', 18, 5), 19 | (5, 'John', 'Stones', 16, 4.25), 20 | (6, 'Nicole', 'Nelson', 17, 5.50); 21 | 22 | 23 | SELECT * FROM `students`; 24 | 25 | 26 | SELECT `last_name`, `age`, `grade` FROM `students`; 27 | 28 | 29 | SELECT * FROM `students` 30 | LIMIT 5; 31 | 32 | 33 | SELECT `last_name`, `grade` FROM `students` 34 | LIMIT 5; 35 | 36 | 37 | TRUNCATE TABLE `students`; 38 | 39 | 40 | DROP TABLE `students`; 41 | 42 | 43 | DROP DATABASE `database_name` 44 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/01. Create Table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `students` ( 2 | `id` INT AUTO_INCREMENT PRIMARY KEY, 3 | `first_name` VARCHAR(50), 4 | `last_name` VARCHAR(50), 5 | `age` INT, 6 | `grade` DOUBLE 7 | ); 8 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/02. Insert Data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `students` (`id`, `first_name`, `last_name`, `age`, `grade`) 2 | VALUES 3 | (1, 'Guy', 'Gilbert', 15, 4.5), 4 | (2, 'Kevin', 'Brown', 17, 5.4), 5 | (3, 'Roberto', 'Tamburello', 19, 6), 6 | (4, 'Linda', 'Smith', 18, 5), 7 | (5, 'John', 'Stones', 16, 4.25), 8 | (6, 'Nicole', 'Nelson', 17, 5.50); 9 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/03. Find All Records.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM `students`; 2 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/04. Find Last Name, Age and Grade.sql: -------------------------------------------------------------------------------- 1 | SELECT `last_name`, `age`, `grade` FROM `students`; 2 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/05. Find First 5 Records.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM `students` 2 | LIMIT 5; 3 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/06. Find First 5 Last Name and Grade.sql: -------------------------------------------------------------------------------- 1 | SELECT `last_name`, `grade` FROM `students` 2 | LIMIT 5; 3 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/07. Truncate Table.sql: -------------------------------------------------------------------------------- 1 | TRUNCATE TABLE `students`; 2 | -------------------------------------------------------------------------------- /SQL/MySQL/Database basics/08. Drop Table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE `students`; 2 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/01. Hello, World.swift: -------------------------------------------------------------------------------- 1 | print("Hello, World!") 2 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/02. Variables.swift: -------------------------------------------------------------------------------- 1 | var food = "banana" 2 | 3 | food = "apple" 4 | 5 | print(food) 6 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/03. Data Types.swift: -------------------------------------------------------------------------------- 1 | var number: Int = 3 2 | 3 | print(number) 4 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/04. Characters and Strings.swift: -------------------------------------------------------------------------------- 1 | var letter: Character = "H" 2 | print(letter) 3 | 4 | var symbol: Character = "@" 5 | print(symbol) 6 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/05. Input and Output.swift: -------------------------------------------------------------------------------- 1 | print("Enter your favorite programming language:") 2 | let name = readLine() 3 | 4 | print("Your favorite programming language is \(name!).") 5 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/06. Code blocks.swift: -------------------------------------------------------------------------------- 1 | if true { 2 | let sum = 7+13 3 | print("Result is \(sum)") 4 | } 5 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/07. Comments.swift: -------------------------------------------------------------------------------- 1 | // Example 1 2 | 3 | // create a variable 4 | var name = "Cartman" 5 | 6 | // print the value 7 | print(name) 8 | 9 | // Example 2 10 | 11 | /* create a variable 12 | to store salary of employees 13 | */ 14 | 15 | var salary = 10000 16 | print(salary) 17 | -------------------------------------------------------------------------------- /Swift/Programiz/First Steps in Swift/08. Optionals.swift: -------------------------------------------------------------------------------- 1 | func testFunction() { 2 | let someValue:Int? = 5 3 | guard let temp = someValue else { 4 | return 5 | } 6 | print("It has some value \(temp)") 7 | } 8 | 9 | testFunction() 10 | -------------------------------------------------------------------------------- /TypeScript/Utility Types/FirstCode.ts: -------------------------------------------------------------------------------- 1 | interface Point { 2 | x: number; 3 | y: number; 4 | } 5 | 6 | let pointPart: Partial = {}; 7 | pointPart.x = 10; 8 | -------------------------------------------------------------------------------- /TypeScript/Utility Types/SecondCode.ts: -------------------------------------------------------------------------------- 1 | interface Car { 2 | make: string; 3 | model: string; 4 | mileage?: number; 5 | } 6 | 7 | let myCar: Required = { 8 | make: 'Ford', 9 | model: 'Focus', 10 | mileage: 12000 11 | }; 12 | -------------------------------------------------------------------------------- /TypeScript/Utility Types/ThirdCode.ts: -------------------------------------------------------------------------------- 1 | const nameAgeMap: Record = { 2 | 'Alice': 21, 3 | 'Bob': 25 4 | }; 5 | --------------------------------------------------------------------------------