Questions

  1. Give the results of the following statements. Do it in your head first, then verify it in the console:
      if 0 [print "0 is true"]      if 13 = 13.0 [print "ok"]      if 13 == 13.0 [print "ok"]
  1. What is the value of out after executing the following statements?
      p: 7      out: either p == 7.0 ["p is 7"]["bad luck"]
  1. Write a code snippet that asks the user whether it is raining, and provide the appropriate whether or not it is raining. Use the multiline block style.
  2. Write a switch snippet where the values are of different datatypes—for example, use an item variable that has the "red" value and test on different values.
  3. Write a case snippet that tests whether a name word contains a vowel (a, e, i, o, or u). Hint: The conditions are of the form  ...

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.