Dne 25.11.2014 v 10:51 Josef Reidinger napsal(a):
[...]
> when I see this change
> ( 
> https://github.com/yast/yast-registration/commit/3e89195d3938d04c3de39b2a5a911daf4d74fe08#diff-10fd72d29294370773d49226a6b02eefL163
> ), I am not sure if it helps with readability.
> I think better change is to change it to
> 
>   if ret == :skip && confirm_skipping
>     log.info "Skipping registration on user request"
>     @registration_skipped = true
>     break
>   end
> end
> 
> in general I am not sure if it is wrong to use return in loops. What is
> rationale behind?

It actually complained because of the extra "if" block.

It's similar to the usual "if" guard clauses:

  if something             return if !something
     do_something    --->  do_something
  end


The requested change is this:

  while foo                while foo
    if something             next if !something
      do_something   --->    do_something
      break                  break
    end                    end
  end

It saves one indentation level.

--

Ladislav Slezák
Appliance department / YaST Developer
Lihovarská 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
[email protected]
SUSE
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to