Created
May 7, 2013 05:04
-
-
Save tyrotinal/5530363 to your computer and use it in GitHub Desktop.
rails: simple for loop to sum numbers from 1 to 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Simple for loop</h1> | |
<h1>Here we are going to count</h1> | |
<p>This is a simple for loop</p> | |
<% sum = 0 %> | |
<% for i in 1..5 %> | |
<% sum = sum+i %> | |
<h3><%= "sum is #{sum}" %></h3> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment