String

# Stringorder='wings'putsorderother_order="fries"putsother_ordercombo_order_1=order+other_orderputscombo_order_1combo_order_2="#{order} and #{other_order}"putscombo_order_2combo_order_3=combo_order_2.sub(/fries/,'waffles with syrup')putscombo_order_3excessive_order='wings with fries and more fries and even more fries'putsexcessive_orderbetter_order=excessive_order.sub(/fries/,'carrots')putsbetter_orderbest_order=better_order.gsub(/fries/,'carrots')putsbest_orderdefdescribe_order(order)iforder=='carrots'return(order+' are the best')elsereturn(order+' are the worst')endendsome_order='hamburger'some_other_order='carrots'putsdescribe_order(some_order)putsdescribe_order(some_other_order)first_letter=some_order[0]putsfirst_letterlast_letter=some_order[-1]putslast_letterhealthy_order='kale chips with vegan brownies'iterations=healthy_order.lengthputsiterationsiterations.timesdo|integer|putsintegerputshealthy_order[integer]enditerations.timesdo|integer|putsintegerputshealthy_order[healthy_order.length-integer-1]end

Hash

person={name:'happy person',eye_color:'blue',address:'500 fell st, st',happy:true,sad::maybe}ppersonpperson[:eye_color]pperson[:happy]item={name:'thing1',location::drawer,siblings:['thing2','thing3'],parent:{name:'thing parent'}}pitempitem[:name]pitem[:parent]car={'name'=>'chevy','motor_type'=>:combustion,'location'=>['somewhere in california']}pcar['name']pcar['motor_type']car.eachdo|key,value|p"This is the car's #{key} and it is #{value}."end