Some of the more common events are what are classified as mouse events, like
'right-click', or even
'mouseover'. Other common events include
keypress events and form submissions.
Loops tell our program to do something over and over; imagine hitting replay/repeat on your favorite song.
for [variable] in [expression]
Using the above syntax our program will execute our
[code] once for each element in our
[expression]. For example, if we have our expression defined as a range of 1 to 7, our for loop will execute our code 7 times, using our variable as a placeholder for each element (number) in our range as it goes through.
for i in 1..7 if i == 1 puts "I've looped 1 time!" elsif i >= 2 puts…
Data types tell your program how to handle what it is that you are telling it to do. Each data type has its own “rules” and is handled in its own specific ways. So let’s dive into each of the data types!
There are a couple of sub-types of numbers called integers and floating-point.
Integers are simply numbers without a decimal point and can be either Bignum or Fixnum depending upon the size of the number, however, 99.99999% of numbers you will most likely be handling will be fixnum.
I'm a Full-Stack Software Engineer, with a background in customer service, who recently graduated from Flatiron School. In my down time I love to bake & garden.