-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.html
More file actions
128 lines (126 loc) · 5.76 KB
/
basic.html
File metadata and controls
128 lines (126 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en">
<head>
<title>Basic Kotlin</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather+Sans:400,300,700" type="text/css">
<link rel="stylesheet" href="static/app.css" type="text/css">
<link rel="shortcut icon" href="static/logo.png" />
<meta name="theme-color" content="#111111">
<meta name="og:type" content="website">
<meta name="og:title" content="MoraSoftware.github.io">
<meta name="og:description" content="Mora Software">
<meta name="og:site_name" content="Mora Software">
<meta name="og:url" content="{{ site.url }}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="block">
<form action="index.html">
<input type="image" src="static/white.jpg" />
</form>
</div>
<div class="block">
<h2>Basic Kotlin</h2>
</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#variables_data_types">Variables data types</a></li>
<li><a data-toggle="tab" href="#class">Class</a></li>
<li><a data-toggle="tab" href="#string_interpolation">String interpolation</a></li>
<li><a data-toggle="tab" href="#ranges">Ranges</a></li>
</ul>
<div class="tab-content">
<div id="variables_data_types" class="tab-pane fade in active">
<h3>Variables data types</h3>
<xmp>var myNumber = 10 // Int
var myDecimal = 1.0 // Float
var isActive = true // Boolean
var myString: String // Mutable String
myString = "Hello World"
myString = "Another World"
val myAnotherString = "My constant string value" // Immutable String
// myAnotherString = "some value" // NOT ALLOWED, since it is immutable
var name: String
name = "Kevin"
var age: Int = 10
var myAge = 10
var isAlive: Boolean = true
var marks: Float = 97.4F
var percentage: Double = 90.78
var gender: Char = 'M'
</xmp>
<a href="https://www.youtube.com/watch?v=SItGASY92HE&list=PLlxmoA0rQ-LwgK1JsnMsakYNACYGa1cjR&index=15"><img src="static/youtube.png"></a>
</div>
<div id="class" class="tab-pane fade">
<h3>Class</h3>
<xmp>
fun main(args: Array<String>) {
var personObj = Person()
personObj.name = "Steve"
print("The name of the person is ${personObj.name}")
}
class Person {
var name: String = ""
}
</xmp>
<p>Another example</p>
<xmp>
fun main(args: Array<String>) {
var personObj = Persson("Steve")
personObj.display()
}
class Persson(var name: String ) {
fun display() {
print("The name of the person is ${name}")
}
}
</xmp>
</div>
<div id="string_interpolation" class="tab-pane fade">
<h3>Explore String Interpolation in Kotlin</h3>
<xmp>
fun main(args: Array<String>) {
var rect = Rectangle()
rect.length = 5
rect.breadth = 3
print("The length of the rectangle is ${rect.length} and breadth is ${rect.breadth}. The area is ${rect.length * rect.breadth}")
}
class Rectangle {
var length: Int = 0
var breadth: Int = 0
}
</xmp>
<a href="https://www.youtube.com/watch?v=EXPZqS8UBrk&index=16&list=PLlxmoA0rQ-LwgK1JsnMsakYNACYGa1cjR"><img src="static/youtube.png"></a>
<p></p>
</div>
<div id="ranges" class="tab-pane fade">
<h3>Ranges</h3>
<xmp>
fun main(args: Array<String>) {
var r1 = 1..5
// This range contains number 1, 2, 3, 4, 5
val r2 = 5 downTo 1
// This range contains number 5, 4, 3, 2, 1
val r3 = 5 downTo 1 step 2
// This range contains number 5, 3, 1
val r4 = 'a'..'z'
// This range contains the values from "a", "b", "c" . . . "z"
var isPresent = 'c' in r4
var countDown = 10.downTo(1)
// This range contains number 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
var moveUp = 1.rangeTo(10)
// This range contains number 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
}
</xmp>
<a href="https://www.youtube.com/watch?v=jNRbbMKOd-E&list=PLlxmoA0rQ-LwgK1JsnMsakYNACYGa1cjR&index=17"><img src="static/youtube.png"></a>
<p></p>
</div>
</div>
</div>
</body>
</html>