Course programme
Manipulating and Checking Values
4 lectures 20:19
The Course Overview
This video will give you an overview about the course.
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Manipulating and Checking Values - Quiz
Manipulating and Checking Values
4 lectures 20:19
The Course Overview
This video will give you an overview about the course.
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Manipulating and Checking Values - Quiz
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
This video will give you an overview about the course.
This video will give you an overview about the course.
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Checking Multiple of a Number
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Up to Swift 4.2, the way we checked if one number is a multiple of another number, was to use the remainder operator and then check if the remainder is 0. If the remainder is zero, then we can be certain the larger number is a multiple of the smaller number. However, the issue with this approach is that we had to check, if the smaller number is not a 0 itself and also the code is longer, and the remainder operator was not designed for this purpose.
• Implement the old way of checking for multiplicity
• Test with divisor being a zero
• Implement the Swift 5 approach to checking for multiplicity
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Character Is a Number
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Prior to Swift 5, checking if a character is a number is tedious, with a three steps approach. First, the character is casted to a String, and then the String is casted to an Int, and only if the Int is not a nil value, we can be certain that the character is a number, because the three steps method was a success. However, the code is error prone, and not as robust as the new Swift 5 approach.
• Implement the old approach, to check if the character is a number
• Test the code to make sure it works
• Implement Swift 5 approach using number function
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Unicode Scalar Properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
When working with unicode scalars in Swift 4.2, we had to check for range of values, for example, in order to know if unicode is a small letter alphabet, we had to check if the unicode value is between 97 and 122, and in order to check if a unicode represents a digit from 0 to 9, we had to check between 48 and 57. This can become very tedious and it is error prone, this is why Swift 5 introduced many unicode properties to make this check very easy.
• Implement the old way of checking digits, lower- and upper-case letters
• Understand the issues with this approach
• Implement Swift 5 approach to use unicode properties
Manipulating and Checking Values - Quiz
Manipulating and Checking Values - Quiz
Manipulating and Checking Values - Quiz
Manipulating and Checking Values - Quiz
Working with Strings and Enums ng the enum value in the switch statement. With Swift 5, by adding a keyword in front...