Skip to content

Instantly share code, notes, and snippets.

@deepakdargade
Forked from revathskumar/array.rb
Last active February 25, 2017 13:24
Show Gist options
  • Save deepakdargade/c93fa0c477814a289f18cfa7b009d68b to your computer and use it in GitHub Desktop.
Save deepakdargade/c93fa0c477814a289f18cfa7b009d68b to your computer and use it in GitHub Desktop.

Revisions

  1. @revathskumar revathskumar revised this gist Jan 30, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions template.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    "Price of the **product** is Rs. **cost**."
  2. @revathskumar revathskumar revised this gist Jan 30, 2013. 3 changed files with 8 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions array.rb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    template = "The price of the %s is Rs. %f."
    template = "Price of the %s is Rs. %f."
    # %s - string, %f - float and %d - integer

    p template % ["apple", 70.00]
    # prints The price of the apple is Rs. 70.000000.
    # prints Price of the apple is Rs. 70.000000.
    4 changes: 4 additions & 0 deletions hash.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    template = "Price of the %{product} is Rs. %{price}."

    p template % {product:"apple", price:70.00}
    # prints Price of the apple is Rs. 70.0.
    4 changes: 2 additions & 2 deletions interpolation.rb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    product = "apple"
    cost = "70.00"

    p "The price of the #{product} is Rs. #{cost}."
    # prints The price of the apple is Rs. 70.00.
    p "Price of the #{product} is Rs. #{cost}."
    # prints Price of the apple is Rs. 70.00.
  3. @revathskumar revathskumar revised this gist Jan 30, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions array.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    template = "The price of the %s is Rs. %f."
    # %s - string, %f - float and %d - integer

    p template % ["apple", 70.00]
    # prints The price of the apple is Rs. 70.000000.
  4. @revathskumar revathskumar revised this gist Jan 30, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion interpolation.rb
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@
    cost = "70.00"

    p "The price of the #{product} is Rs. #{cost}."
    // prints The price of the apple is Rs. 70.00.
    # prints The price of the apple is Rs. 70.00.
  5. @revathskumar revathskumar created this gist Jan 30, 2013.
    5 changes: 5 additions & 0 deletions interpolation.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    product = "apple"
    cost = "70.00"

    p "The price of the #{product} is Rs. #{cost}."
    // prints The price of the apple is Rs. 70.00.