In this tutorial, we will learn what is associated values in swift and how to use them. To learn more about associated values, suppose we are writing an iOS application in swift that will greet the user differently for the first time use and second time use.For example,suppose user 'Albert' is using the app for the first time. It will show one message Hello Albert ! Welcome to our app.. Similarly, after 10 time when he will open,it will print Hey Albert ! Thank you for using our app for more than 10 times. Please give us a rating on Appstore.. How we are going to use it ? Yes,we have different ways to solve this problem but we will learn how to solve it using enum in swift :.
ReadEnumeration is actually used to define a common types of group of data.For example, following is a enumeration with seven different values or cases :.
ReadIn swift, we can assign raw values while defining an enumeration.Means these are default values for enumeration cases. Let's take a look at the below example :.
ReadIn this tutorial, we will learn how to get the index of a key in swift Dictionary. Many time we need the index for a key in a dictionary. We can use this process at that time. Let me show you with an example :.
ReadIn this tutorial, we will learn how to create a random number in python. Generating a random number in python is easier than you think. Everything is already defined in a module called random. Just import it and use its inbuilt functions.
ReadIn this Java program, we will learn how to find one substring in a string. The user will first enter the string and then he will enter the substring . Our program will check if it exist in the string or not. If yes, it will print the index of the substring. Let's take a look at the program first :.
ReadIn this Java programming tutorial, we will learn how to extract a substring from a user given string. The program will ask the user to enter a string and first and the second index of the substring. Then it will print out the substring of that string. Let's take a look at the program :.
ReadIn this Java tutorial, we will learn how to use contentEquals() method to compare two strings. The syntax of contentEquals() method is as below :.
ReadIn this tutorial, we will learn how to solve a common interview question known as 3SUM problem. The problem is one array is given and you have to find three numbers the sum of which is 0. For example, for the array (1,2,3,-4), the sum of 1,3 and -4 is 0. So it will print these three numbers.
ReadIn this C programming tutorial, we will learn how to find the count of lowercase characters,uppercase characters,special characters and numeric characters in a string.The program will ask the user to enter one string , it will find out the count and then print out the result.
Read