Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val x = List((("Burger and chips",4.99),4.99,1), (("Pasta & Chicken with Salad",8.99), 8.99,2), (("Rice & Chicken with Chips",8.99), 8.99,2))
- x.foreach(x => println(x._3 + " x " + x._1 +"tttt"+"$"+x._2 * x._3 ))
- 1 x (Burger and chips,4.99) $4.99
- 2 x (Pasta & Chicken with Salad,8.99) $17.98
- 2 x (Rice & Chicken with Chips,8.99) $17.98
- 1 x (Burger and chips,4.99) $4.99
- 2 x (Pasta & Chicken with Salad,8.99) $17.98
- 2 x (Rice & Chicken with Chips,8.99) $17.98
- x.foreach {
- case (text, price, amount) => println(f"$amount x $text%-40s $$${price*amount}")
- }
- // prints:
- 1 x (Burger and chips,4.99) $4.99
- 2 x (Pasta & Chicken with Salad,8.99) $17.98
- 2 x (Rice & Chicken with Chips,8.99) $17.98
Add Comment
Please, Sign In to add comment