okay, for this day I do
1. Strings
Different waves to print and format your code.
P, print, puts.
String operations: + (concatenation), .length, and
Exercies:
**What is the index of g in the string "coding"?
**What will "Hey-Programmers".length < 5 evaluate to?
**What will "coding"[2] evaluate to?
2. Variables
Exercising
Predict what the following puts lines with question marks will print out
num = 40
num + 5
puts "---1:"
puts num # ?
num += 2
puts "---2:"
puts num # ?
isEven = num % 2 == 0
puts "---3:"
puts isEven # ?
isNegative = num < 0
puts "---4:"
puts isNegative # ?
puts "---5:"
puts isEven || isNegative # ?
puts "---6:"
puts isEven && isNegative # ?
puts "---7:"
puts isEven && !isNegative # ?
Top comments (0)