Ruby Next statement The Ruby Next statement is used to skip the rest of the current iteration. Next Statement syntax next Next Statement example for x in 1..5 if x < 4 then next end puts "The value of x =...
Ruby Until Loop The Ruby Until loop Statement. The Until loop executes ruby code while condition is false. Until loop syntax until condition do -- Ruby code end --or begin -- Ruby code end until condition Until loop example 1 $x...
Ruby While Loop The Ruby While loop statement syntax and example. The While loop executes ruby code while condition is true. While loop syntax while condition -- Ruby code end --or begin -- Ruby code end while condition While loop example...
Ruby For Loop The Ruby For Loop statement syntax and example. For loop syntax for value in expression do -- Ruby code end For loop example $x = 1 for $x in [1,2,3,4,5] do puts("The value of x = #$x" )...
Ruby CASE The Ruby CASE statement syntax and example. Ruby CASE syntax case expression when expression [, expression ...] [then] -- Ruby code else -- Ruby code end Ruby CASE example x = 3 case when x == 1 puts "false"...