summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-07 17:56:55 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-07 17:56:55 +0900
commit9bed29bf966223c9da792ca2590f8a9a6fd3bf2f (patch)
treec211c60638a9a80852bcafe2e4769d5be46707ae
parent32faeedb1eb19e0d4ab86a2106987f7a485e376e (diff)
downloadmruby-9bed29bf966223c9da792ca2590f8a9a6fd3bf2f.tar.gz
mruby-9bed29bf966223c9da792ca2590f8a9a6fd3bf2f.zip
define print and printf in mrblib
-rw-r--r--mrblib/kernel.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb
index f98284d24..af743e12a 100644
--- a/mrblib/kernel.rb
+++ b/mrblib/kernel.rb
@@ -65,4 +65,29 @@ module Kernel
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