Permalink
Browse files

define print and printf in mrblib

  • Loading branch information...
1 parent 32faeed commit 9bed29bf966223c9da792ca2590f8a9a6fd3bf2f @matz matz committed May 7, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 mrblib/kernel.rb
View
@@ -65,4 +65,29 @@ def loop #(&block)
def send(symbol, *args, &block)
### *** TODO *** ###
end
+
+ ##
+ # Print arguments
+ #
+ # ISO 15.3.1.2.10
+ def print(*args)
+ args.each do|x|
+ if x.nil?
+ __printstr__ "nil"
+ else
+ __printstr__ x.to_s
+ end
+ end
+ end
+
+ ##
+ # Print arguments with newline
+ #
+ # ISO 15.3.1.2.11
+ def puts(*args)
+ args.each do|x|
+ __printstr__ x.to_s
+ __printstr__ "\n"
+ end
+ end
end

0 comments on commit 9bed29b

Please sign in to comment.