Jump to content

User input/Text: Difference between revisions

no edit summary
No edit summary
Line 2,422:
<syntaxhighlight lang="spl">text = #.input("Input a string")
number = #.val(#.input("Input a number"))</syntaxhighlight>
 
=={{header|Ada}}==
{{As a structured script}}
<syntaxhighlight lang="ada">
#!/usr/local/bin/spar
pragma annotate( summary, "get_string" )
@( description, "Input a string and the integer 75000 from the text console." )
@( see_also, "https://rosettacode.org/wiki/User_input/Text" )
@( author, "Ken O. Burtch" );
pragma license( unrestricted );
 
pragma restriction( no_external_commands );
 
procedure get_string is
s : unbounded_string;
i : integer;
begin
s := get_line;
i := integer( numerics.value( get_line ) );
? s @ i;
exception when others =>
put_line( standard_error, "the value is not valid" );
end get_string;
</syntaxhilight>
{{As a unstructured script and no exception handling}}
<syntaxhighlight lang="ada">
s : universal_string := get_line;
i : universal_numeric := numerics.value( get_line );
? s @ i;
</syntaxhilight>
 
=={{header|Standard ML}}==
76

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.