https://bugs.ruby-lang.org/
https://bugs.ruby-lang.org/favicon.ico?1711330511
2012-11-13T04:23:21Z
Ruby Issue Tracking System
Ruby master - Bug #7338: loop command doesn't accept begin/end, only { }
https://bugs.ruby-lang.org/issues/7338?journal_id=32819
2012-11-13T04:23:21Z
nathan.f77 (Nathan Broadbent)
nathan.f77@gmail.com
<ul></ul><p>Hi there,</p>
<p>Try 'loop do' instead of 'loop begin'</p>
<p>Best,<br>
Nathan</p>
<p>On Tuesday, 13 November 2012, dwilde1 (Donald Wilde) wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: loop command doesn't accept begin/end, only { } (Rejected)" href="https://bugs.ruby-lang.org/issues/7338">#7338</a> has been reported by dwilde1 (Donald Wilde).</p>
<hr>
<p>Bug <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: loop command doesn't accept begin/end, only { } (Rejected)" href="https://bugs.ruby-lang.org/issues/7338">#7338</a>: loop command doesn't accept begin/end, only { }<br>
<a href="https://bugs.ruby-lang.org/issues/7338" class="external">https://bugs.ruby-lang.org/issues/7338</a></p>
<p>Author: dwilde1 (Donald Wilde)<br>
Status: Open<br>
Priority: Normal<br>
Assignee:<br>
Category:<br>
Target version:<br>
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]</p>
<p>def token_generator<br>
random = Random.new<br>
alpha = Array.new<br>
('a' .. 'z').each do | c |<br>
alpha << c<br>
end<br>
('A' .. 'Z').each do | c |<br>
alpha << c<br>
end<br>
numbers = %w{ 0 1 2 3 4 5 6 7 8 9 }<br>
loop begin<br>
unique_string = ''<br>
0.upto( 19 ) do | n |<br>
if n.even? then<br>
unique_string << alpha[ random.rand( 52 ) ]<br>
else<br>
unique_string << numbers[ random.rand( 10 ) ]<br>
end<br>
end<br>
break unless @sessions.include?( unique_string.to_sym )<br>
end<br>
unique_string<br>
end</p>
<p>causes:</p>
<p>/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in <code>require': /home/devel/ISF_Server/Actors/DataProvider.rb:49: syntax error, unexpected keyword_do_block, expecting keyword_end (SyntaxError) 0.upto( 19 ) do | n | ^ /home/devel/ISF_Server/Actors/DataProvider.rb:72: syntax error, unexpected keyword_end, expecting $end from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in </code>require'<br>
from ./server-work.rb:7:in `'</p>
<p>but replacing begin/end with { } works.</p>
<p>--<br>
<a href="http://bugs.ruby-lang.org/" class="external">http://bugs.ruby-lang.org/</a></p>
</blockquote>
Ruby master - Bug #7338: loop command doesn't accept begin/end, only { }
https://bugs.ruby-lang.org/issues/7338?journal_id=32820
2012-11-13T04:47:59Z
dwilde1 (Donald Wilde)
donald.s.wilde@intel.com
<ul></ul><p>My bad, thanks, Nathan. Switching between languages too often! :D</p>
Ruby master - Bug #7338: loop command doesn't accept begin/end, only { }
https://bugs.ruby-lang.org/issues/7338?journal_id=32822
2012-11-13T06:26:52Z
marcandre (Marc-Andre Lafortune)
marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul>