2023-05-23 09:19:31 +02:00
|
|
|
# Lösung: String-Formatierung
|
|
|
|
|
2023-05-25 17:49:42 +02:00
|
|
|
|
|
|
|
|
2023-05-23 09:19:31 +02:00
|
|
|
```ruby
|
|
|
|
name = "Peter"
|
|
|
|
gewicht = 90
|
|
|
|
|
|
|
|
puts name + " wiegt " + gewicht.to_s + " kg"
|
|
|
|
puts "#{name} wiegt #{gewicht} kg"
|
|
|
|
puts "%s wiegt %d kg" % [ name, gewicht ]
|
|
|
|
```
|