There are two types of variables – mutable and immutable. An immutable variable is one whose value cannot be changed, also known as unchangeable or read-only variable. On the other hand the value of the mutable variable can be changed. Immutable variable: val keyword Immutable variable is declared using val keyword in Kotlin. In this example, we have declared an immutable variable myName using val keyword and later displayed the value of it. package tejprogramming fun main(args : Array<String>){ /** * This is an immutable variable * also called unchangeable variable * or read-only variable. */ val myName = "Suvidha" println("My Name is: "+myName) } …
-
-
Data structures: A data structure is a way of organizing data items such that data items can be accessed efficiently. Or A data structure is a way of organizing data items that considers not only the items stored, but also their relationship to each other. Types of data Structure: Primitive data structure: The data structures that are directly operated by machine level instructions are known as primitive data structures. Following are the primitive data structure: (a) Integer : – Integer is a represent numbers. – The set of integer is: {…………-(n+1), -n,…,-2,-1,0,1,2,……..,n,n+1,………} (b) Real: – The number having decimal point…
-
[vc_row][vc_column][vc_column_text]There are certain words in Kotlin that have special meaning and cannot be used as identifiers(variable name, function name, class name etc). These words are called reserved words or keywords. In this guide, we will learn about keywords and identifiers.[/vc_column_text][vc_custom_heading text=”Types of Keywords in Kotlin “][vc_column_text]We have two types of keywords: 1. Hard Keywords 2. Soft Keywords[/vc_column_text][vc_custom_heading text=”1. Hard Keywords”][vc_column_text]These keywords cannot be used as identifiers. For example This is valid: //valid variable name val myvar = 5 This is invalid: //error: "else" cannot be used as a variable name val else = 5 Kotlin Hard keywords Table as class break…
-
[vc_row][vc_column][vc_column_text]Kotlin is a statically-typed programming language, developed by JetBrains. If you have basic knowledge of Java, you will be able to learn Kotlin in no time. This Kotlin tutorial is designed for beginners so you would be able to understand Kotlin programming even if you have no knowledge of Java. Kotlin and Java are interoperable which means you can use them together in a Project as well as you can re-write a Java code in Kotlin efficiently. The syntax of Kotlin is concise than Java. In this tutorial you will learn why use Kotlin, what are the advantages of it and several guides…
-
[vc_row][vc_column][vc_custom_heading text=”PHP Syntax”][vc_column_text]The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. The mechanism for doing so is known as ‘escaping to PHP’. There are four ways to do this −[/vc_column_text][vc_custom_heading text=”Canonical PHP tags”][vc_column_text]The most universally effective PHP tag style is − <?php ... ?> If you use this style, you can be positive that your tags will always be correctly interpreted.[/vc_column_text][vc_custom_heading text=”Short-open (SGML-style) tags”][vc_column_text]Short or short-open tags look like this − <? ... ?> [/vc_column_text][vc_column_text]Short tags are, as one might expect, the shortest option You must do one of two things to…
-
[vc_row][vc_column][vc_column_text]In order to develop and run PHP Web pages three vital components need to be installed on your computer system.[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][ul] Web Server − PHP will work with virtually all Web Server software, including Microsoft’s Internet Information Server (IIS) but then most often used is freely available Apache Server. Database − PHP will work with virtually all database software, including Oracle and Sybase but most commonly used is freely available MySQL database. PHP Parser − In order to process PHP script instructions a parser must be installed to generate HTML output that can be sent to the Web Browser. This tutorial will guide you…
-
[vc_row][vc_column][vc_column_text]The PHP Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. This tutorial helps you to build your base with PHP.[/vc_column_text][vc_custom_heading text=”Why to Learn PHP?”][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994. PHP is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will…
-
Objective In this challenge, we’re getting started with conditional statements. Check out the Tutorial tab for learning materials and an instructional video! Task Given an integer, n, perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5, print Not Weird If n is even and in the inclusive range of 6 to 20, print Weird If n is even and greater than 20, print Not Weird Complete the stub code provided in your editor to print whether or not n is weird. Input Format A single line containing a positive integer, n . Constraints 1<= n <= 100 Output Format Print Weird if…
-
ObjectiveIn this challenge, you’ll work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video! TaskGiven the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost. Note: Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result! Input Format There are 3 lines of numeric input:The first line has a double, mealCost(the cost of the meal before tax and tip).The second line has an integer, tipPercent (the percentage of mealCost being…
-
Objective Today, we’re discussing data types. Check out the Tutorial tab for learning materials and an instructional video! Task Complete the code in the editor below. The variables i ,d , and s are already declared and initialized for you. You must: Declare 3 variables: one of type int, one of type double, and one of type String. Read 3 lines of input from stdin (according to the sequence given in the Input Format section below) and initialize your 3 variables. Use the + operator to perform the following operations: Print the sum of i plus your int variable on a new line. Print the sum of d plus your double variable to a scale of…