Looping

Here is where computers shine, Im talking about do the same thing over and over and over again, with precision, consistency, & accuracy. the best way to use this power in the Ruby language is using loops, here I will post some example of some loops, for more details see the following links: Link_1


“while” Loop

Modifier “while”

“until” Loop

Modifier “until”

“for”  Loop

“begin  …  end”

This will allow to run the cycle once before the condition.

“break”   <– to leave the block early

“.times”

Ok this is not a loop but you can use it as one and I like to use it very often

“next”  <– skpis the rest of the current iteration

“redo”  <– Re-Execute current iteration

Filp-Flop

This conditional activate itself every time the conditions are withing in range.

 

 

 

 

 

 



Copyright 2017. All rights reserved.

Posted January 6, 2017 by Edmundo in category "Ruby