fork download
  1. Program Example74;
  2.  
  3. { Program to demonstrate the Val function. }
  4. Var I, Code : Integer;
  5. S:string;
  6. begin
  7. readln(S);
  8. if S[1]<>'0' then Val (S,I,Code)
  9. else writeln('ciao');
  10. If Code<>0 then
  11. Writeln ('Error at position ',code,' : ',Paramstr(1)[Code])
  12. else
  13. Writeln ('Value : ',I);
  14. end.
Success #stdin #stdout 0s 5324KB
stdin
023
stdout
ciao
Value : 0