Ruby / Rails - general function syntax example


/ Published in: Ruby



Copy this code and paste it in your HTML
  1. def my_function( a )
  2. puts "Hello, #{a}"
  3. return a.length
  4. end
  5.  
  6. len = my_function( "Giraffe" )
  7. puts "My secret word is #{len} long"

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.