This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val escapeQuotes = "\"a\"" | |
println("\thello") | |
println('\n') | |
println(escapeQuotes) | |
println("\\h") | |
println('5'.code) // prints the ASCII code | |
println(56.toChar()) // prints 8 the value for ASCII code 56 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
// double declaration | |
val d = 1.234 // type is inferred | |
val doubleNotation = 1.2e10 | |
println(doubleNotation) | |
// float declaration | |
val floatValue = 123.23452F | |
val floatValueRoundedOff = 1.234278690234f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val a = 10 | |
//a = 11 //Error: val cannot be reassigned | |
// Line: 3 won't compile hence commented | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
println("Hello World") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
sumOfTwoBytes() | |
} | |
/* | |
Why the answer is -16 when we expect the result in byte. Let's do that manually. We know that byte can store values | |
from -128 to 127 only. Here we want to store the 240 which is not possible. But how -16 is returned. | |
Binary value of 240 is 11110000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.jetbrains.kotlin.multiplatform' | |
} | |
apply plugin: 'com.android.library' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'maven-publish' | |
// Because the components are created only during the afterEvaluate phase, you must | |
// configure your publications using the afterEvaluate() lifecycle method. | |
afterEvaluate { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.diffplug.gradle.spotless' | |
spotless { | |
kotlin { | |
target '**/*.kt' | |
ktlint("0.36.0") | |
//ktlint("0.36.0").userData(['disabled_rules': 'no-wildcard-imports']) | |
trimTrailingWhitespace() | |
indentWithSpaces() | |
endWithNewline() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LC_ALL=C | |
RED='\033[0;1;31m' | |
NC='\033[0m' # No Color | |
echo "Running git pre-commit hook" | |
local_branch="$(git rev-parse --abbrev-ref HEAD)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'kotlin-kapt' | |
apply plugin: "androidx.navigation.safeargs.kotlin" | |
apply plugin: 'com.google.gms.google-services' | |
apply from: "$rootDir/spotless.gradle" | |
def keystorePropertiesFile = rootProject.file("keystore.properties") | |
def keystoreProperties = new Properties() |