How to run Ruby code from terminal?
If Ruby is installed, then where yourfile.rb is the file containing the ruby code. Or to start the interactive Ruby environment, where you can type lines of code and see the results immediately.
If Ruby is installed, then where yourfile.rb is the file containing the ruby code. Or to start the interactive Ruby environment, where you can type lines of code and see the results immediately.
If Ruby is installed, then where yourfile.rb is the file containing the ruby code. Or to start the interactive Ruby environment, where you can type lines of code and see the results immediately.
They are completely equivalent when used with printf(). Personally, I prefer %d, it’s used more often (should I say “it’s the idiomatic conversion specifier for int“?). (One difference between %i and %d is that when used with scanf(), then %d always expects a decimal integer, whereas %i recognizes the 0 and 0x prefixes as octal and hexadecimal, but no sane programmer uses scanf() anyway so this should not be a concern.)