Try Ruby

Before we learn about Back-end Development, we have to learn about Ruby first. Ruby is a programming language. Let's get our hands dirty by trying Ruby. Finish the following tutorial up to Level #4 (stop when you see Level #5).

Summary of Try Ruby

  • Ruby recognizes numbers and mathematics operators like 2 + 6, 4 * 4 and 100 / 5
  • Ruby also recognizes text or string like your name. By enclosing letters in quotes, you make a string, like "Tony". A string has hidden methods and properties like .reverse and .length
  • You can even multiply a string "Jimmy" * 5
  • But, you can't do 40.reverse. Why? Because .reverse is a string method. 40 is a number, not a string.
  • However, you can convert a number to a string by using to_s, standing for "to string"
  • to_s converts values to strings, to_i to integers (numbers), and to_a to arrays.
  • You can define a list of things using the brackets [ and ], so a list of numbers looks like this [1, 2, 3]. In Ruby, we call a list an array.
  • Like strings, an array also has methods like .max.
  • To store your values, be it an integer or an array, you can use a variable to store your values.
  • Lastly, you were introduced to a hash or dictionary. A hash has many key-value pairs.

results matching ""

    No results matching ""