View Problem

Perform an action if a condition is true (IF .. THEN)

Given a variable name, if the value is "Bob", display the string "Hello, Bob!". Perform no action if the name is not equal.
ExpandDiskEdit
fsharp
if name = "Bob" then printfn "Hello, %s!" name
ExpandDiskEdit
fsharp
name = "Bob" && begin printfn "Hello, %s!" name ; true end
ExpandDiskEdit
cpp C++/CLI .NET 2.0
if (name == "Bob") Console::WriteLine("Hello, {0}!", name);
ExpandDiskEdit
cpp
if (name == "Bob") std::cout << "Hello, " << name << "!" << std::endl;
DiskEdit
clojure
(def person "Bob")
(if (= person "Bob")
(println "Hello, Bob!"))

Submit a new solution for fsharp, cpp, or clojure
There are 17 other solutions in additional languages (csharp, erlang, fantom, groovy ...)