printf with format : printf « Development « Ruby





printf with format


printf("Number: %5.2f,\nString: %s\n", 1.23, "hello")

 

Related examples in the same category

1.Use printf to print the output to your display (the default standard output device).
2.printf("%.55f", 1.9)
3.printf("%.55f", 1.8 + 0.1)
4.printf prints its arguments under the control of a format string