User Input: Difference between revisions
Content added Content deleted
(Modula-3) |
No edit summary |
||
Line 5: | Line 5: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
{{works with|GCC|4.1.2}} |
{{works with|GCC|4.1.2}} |
||
<ada> |
<lang ada> |
||
function Get_String return String is |
function Get_String return String is |
||
Line : String (1 .. 1_000); |
Line : String (1 .. 1_000); |
||
Line 19: | Line 19: | ||
-- may raise exception Constraint_Error if value entered is not a well-formed integer |
-- may raise exception Constraint_Error if value entered is not a well-formed integer |
||
end Get_Integer; |
end Get_Integer; |
||
</ |
</lang> |
||
The functions above may be called as shown below |
The functions above may be called as shown below |
||
<ada> |
<lang ada> |
||
My_String : String := Get_String; |
My_String : String := Get_String; |
||
My_Integer : Integer := Get_Integer; |
My_Integer : Integer := Get_Integer; |
||
</ |
</lang> |
||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
Line 231: | Line 231: | ||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
<ocaml>print_string "Enter a string: "; |
<lang ocaml>print_string "Enter a string: "; |
||
let str = read_line () in |
let str = read_line () in |
||
print_string "Enter an integer: "; |
print_string "Enter an integer: "; |
||
let num = read_int () in |
let num = read_int () in |
||
Printf.printf "%s%d\n" str num</ |
Printf.printf "%s%d\n" str num</lang> |
||
=={{header|Pascal}}== |
=={{header|Pascal}}== |