Login
|
Signup
langref.org
-
groovy
,
erlang
, and
fantom
add..
all
clojure
cpp
csharp
fsharp
go
haskell
java
ocaml
perl
php
python
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Strings
Declaration
Define a string containing variables and expressions
Given variables a=3 and b=4 output
"3+4=7"
groovy
println "$a+$b=${a+b}"
a = 3
b = 4
println "$a+$b=${a+b}"
groovy
printf "%d+%d=%d\n", a, b, a + b
a = 3
b = 4
printf "%d+%d=%d\n", a, b, a + b
erlang
A = 3, B = 4,
io:format("~B+~B=~B~n", [A, B, (A+B)]).
-module(stvarexp).
-export([start/0]).
start() ->
A = 3, B = 4,
io:format("~B+~B=~B~n", [A, B, (A+B)]).
fantom
echo("$a+$b=${a+b}")
class SolutionXX
{
static Void main()
{
echo("$a+$b=${a+b}")
}
}
Submit a new solution for
groovy
,
erlang
, or
fantom
There are 26 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
fsharp
...)