Good Afternoon,
Following Paul's guidance of post your progress to a social media site, I figure I would use this site to post my progress and share some of my findings.
I found that Day 2 was fantastic for building a foundation and deepening my general overall knowledge. As a visual learner, I found the short companion videos very useful in understanding new material. By applying previously learned lessons to more recent material, I feel I am reinforcing that information.
I have attached a snippet of code I used to help me understand "Sets" and understand how I could use the function of a "Set" in my code. (For me personally, by applying this to something that is a standard function in coding, I can then understand the potential of how I can use " Sets" I know everyone is different, but maybe this will help someone understand this better)
// Code Block - Testing an IF Statement using the contents of a Set for the evaluation condition
// variables and constants section
let colors = Set (["red", "Green", "Blue"])
var playerScore = 0
// If Statement
if colors.contains("Yellow") {
print("This is true")
playerScore += 10
}else {
print("This is not true")
playerScore += -10
}
// Final Action - In this case printing the results of the players score.
print(playerScore)
Since a "SET" does not have any specific order or location, I wanted to understand how I could use the values in a "Set" with practical coding logic. To see this in practice, I used an "IF" statement that would check the contents of the "Set," and if the condition statement equal to the contents information, then it would execute the If statement as "true"; otherwise, it would complete the statement as "false."
Although the context around using a PlayerScore might not be relevant, I wanted to see if the code's mechanics would work.