-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin Wang
committed
Apr 6, 2012
0 parents
commit 573ec03
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<loadpath> | ||
<pathentry path="" type="src"/> | ||
<pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/> | ||
</loadpath> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>FirstRuby</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.rubypeople.rdt.core.rubybuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.rubypeople.rdt.core.rubynature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
3.times { print "Ruby!"} | ||
1.upto(9) { |x| print x} | ||
|
||
a =[1,2,3] | ||
a.each do |elt| | ||
print "\n" | ||
print elt | ||
end | ||
|
||
b = [1,2,3,4] | ||
|
||
c = b.map { |e| e*e } | ||
|
||
print "\n" | ||
c.each do |e| | ||
print e | ||
print " " | ||
end | ||
print "\n" | ||
|
||
d = c.select {|x| x > 10} | ||
d.each do |e| | ||
print e | ||
print " " | ||
end | ||
print "\n" | ||
|
||
print "array inject demo" | ||
sum = 0 | ||
sum = a.inject {|sum, x| sum + x} | ||
|
||
print sum |