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.
DiskEdit
csharp
if (name == "Bob") Console.WriteLine("Hello, {0}!", name);
ExpandDiskEdit
erlang
if (Name == "Bob") -> io:format("Hello, ~s!~n", [Name]) ; true -> false end.
ExpandDiskEdit
erlang
case Name of "Bob" -> io:format("Hello, ~s!~n", [Name]) ; _ -> false end.
ExpandDiskEdit
erlang
Name == "Bob" andalso (begin io:format("Hello, ~s!~n", [Name]), true end).
ExpandDiskEdit
fsharp
if name = "Bob" then printfn "Hello, %s!" name
ExpandDiskEdit
fsharp
name = "Bob" && begin printfn "Hello, %s!" name ; true end

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