General Programming/Other Languages
This chapter is from the book
- Declare and initialize a pair of variables for each type listed in this chapter, both explicitly and using type inference. What do you need to do to get the compiler to infer the Float type?
- Create a constant with an emoji character in the name. Are you able to easily use the constant? Does this help with the readability of your code?
- How would you explicitly declare an array that stores another array of Ints as each element? Show how you would access elements by using subscripts.
- Set up a dictionary that uses Ints as the key. How is this different from using an array? When could using a dictionary such as this be better than using an array?
- Create a Fizz Buzz implementation. Iterate through the numbers from 1 to 100. If a number is evenly divisible by 3, print Fizz. If the number is evenly divisible by 5, print Buzz. If the number is evenly divisible by both 3 and 5, print Fizz Buzz. For all other numbers, just print the number.