Can anyone help me on how to skip index in ARRAY.each_with_index loop?
Please look at below case:
In a ARRAY.each_with_index loop, I would like increase the index by 10
whenever a condition is met.
arr is array of numbers from 0 to 50
arr.each_with_index do |x,i|
if i % 10 == 0
puts #{x}
Use the `next` statement.
http://www.tutorialspoint.com/ruby/ruby_loops.htm
--
Dheeraj Kumar
On Thursday 23 May 2013 at 2:54 PM, Ajit Teli wrote:
Can anyone help me on how to skip index in ARRAY.each_with_index loop?
Please look at below case:
In a ARRAY.each_with_index loop, I would
On Thursday, 23 May 2013 11:24:36 UTC+2, Ruby-Forum.com User wrote:
Can anyone help me on how to skip index in ARRAY.each_with_index loop?
Please look at below case:
In a ARRAY.each_with_index loop, I would like increase the index by 10
whenever a condition is met.
arr is array of
Hi,
I've got following two files with same names under javascripts and
stylesheets directories as:
- app/assets/javascripts/test_vendor.js
- app/assets/stylesheets/test_vendor.scss
Essentially a JS and an stylesheet files with same name.
Dear Dheeraj,
Thanks for your reply.
The statement `next` will increment the index by 1. But I want to
increment the index by 10.
Thanks,
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To
use `next if (i % 10 != 0)`
--
Dheeraj Kumar
On Thursday 23 May 2013 at 3:25 PM, Ajit Teli wrote:
Dear Dheeraj,
Thanks for your reply.
The statement `next` will increment the index by 1. But I want to
increment the index by 10.
Thanks,
--
Posted via
Never mind, My bad :)
I was not using correct convention for including css file.
it has to be test_vendor.css instead of test_vendor.scss
Following works.
*config.assets.precompile += %w(test_vendor.js test_vendor.css)*
On Thursday, 23 May 2013 15:20:51 UTC+5:30, Farukh D.M wrote:
Hi,
Write a loop that generates the desired indexes and then reference arr:
(0..5).each do |j|
i = 10*j
puts #{arr[i]} at #{i}
end
Your example output does not match the code. It does not include 0, 20,
and 40.
On Thursday, May 23, 2013 5:24:36 AM UTC-4, Ruby-Forum.com User wrote:
Can
jsnark wrote in post #1109941:
Write a loop that generates the desired indexes and then reference arr:
(0..5).each do |j|
i = 10*j
puts #{arr[i]} at #{i}
end
Your example output does not match the code. It does not include 0, 20,
and 40.
# Print every 10th object
On 2013-May-23, at 05:24 , Ajit Teli wrote:
Can anyone help me on how to skip index in ARRAY.each_with_index loop?
Please look at below case:
In a ARRAY.each_with_index loop, I would like increase the index by 10
whenever a condition is met.
arr is array of numbers from 0 to 50
I couldn't run resque workers in appfog (RoR+Resque+Appfog)
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-talk+unsubscr...@googlegroups.com.
Seems like it went well. The site is there. And when I do an update and
push to it with git and run cap deploy again I can see my edits in a file
on the server but not on the webpage.
For example
if I go into the folder current and run grep -rn 'testingcapdeploy1' *
I get
Hi!
Reading Rails For .NET Developers i started to consider the example of
building the flight system with cancellations. So, I've generated flights
scaffold and passengers scaffold and I'd like that we could cancel the
flight and then, each of the passengers would be informed about that fact.
On 23 May 2013 13:52, jsnark s...@monmouth.com wrote:
Write a loop that generates the desired indexes and then reference arr:
(0..5).each do |j|
i = 10*j
puts #{arr[i]} at #{i}
end
Your example output does not match the code. It does not include 0, 20, and
40.
I don't think the OP
On 23 May 2013 12:56, Mateusz Urban mateuszurb...@gmail.com wrote:
Hi!
Reading Rails For .NET Developers i started to consider the example of
building the flight system with cancellations. So, I've generated flights
scaffold and passengers scaffold and I'd like that we could cancel the
flight
Colin Law wrote in post #1109974:
There is no need for a separate controller, one way would be to handle
it within the flights controller Edit action, using a url parameter or
the Submit button name to indicate that cancel is required rather than
edit.
However, REST should not be treated as a
On 23 May 2013 21:30, Robert Walker li...@ruby-forum.com wrote:
Colin Law wrote in post #1109974:
There is no need for a separate controller, one way would be to handle
it within the flights controller Edit action, using a url parameter or
the Submit button name to indicate that cancel is
On Wed, May 22, 2013 at 8:30 AM, bh bakhtiyo...@gmail.com wrote:
I couldn't run resque workers in appfog (RoR+Resque+Appfog)
Suggested: http://www.catb.org/esr/faqs/smart-questions.html
--
Hassan Schroeder hassan.schroe...@gmail.com
http://about.me/hassanschroeder
Colin Law wrote in post #1109983:
On 23 May 2013 21:30, Robert Walker li...@ruby-forum.com wrote:
creating a new flight on the collection of flights, rather than changing
the state of an existing flight. Sure POST would work (and technically
PATH/PUT is simulated using a POST), but using
On Wednesday, May 22, 2013 1:26:06 PM UTC-4, Alfred Nutile wrote:
Seems like it went well. The site is there. And when I do an update and
push to it with git and run cap deploy again I can see my edits in a file
on the server but not on the webpage.
For example
if I go into the folder
Hello,
I am looking for a good solution for a community development project. I
want users or our application to be able to create feature requests,
vote on them and track progress over time. I have done a little research
found this to be closest to what I am looking for.
21 matches
Mail list logo