+ 1

Logic nesting in ruby

what are the rules for nesting logic within logic in ruby? Can you nest an if/else inside an if/else or an if/else inside a while inside a case inside an unless? How many times over can it be done?

31st Jul 2017, 12:51 AM
Ryan Liston
Ryan Liston - avatar
3 Antworten
+ 1
You can nest any logic, conditionals, loops inside any logic, conditionals or loops. There are no limits. You can use them as many times as you need. Just make sure you don't create an infinite loop.
31st Jul 2017, 4:58 PM
Salekin
Salekin - avatar
+ 1
Thank you. I've discovered that for the most part. I've learned setting global variables is neccasary for sharing variables between loops and conditionals. Also I was trying to write a program without setting up methods or objects but they really do make things more smooth and simple.
31st Jul 2017, 5:17 PM
Ryan Liston
Ryan Liston - avatar
0
Good luck @Ryan Liston.
31st Jul 2017, 5:24 PM
Salekin
Salekin - avatar