Recent

Author Topic: readln executed before writeln  (Read 1239 times)

homojavanicus

  • Newbie
  • Posts: 4
readln executed before writeln
« on: December 01, 2019, 12:17:21 pm »
hi, i'm new in pascal, and generally new to the computer programming world. I'm in my way learning pascal. I was trying to write a goal tracker program, and my program runs seamlessly unless one thing. the readln function that on the lower line, executed before the writeln function that is wroten first. and it like the program ask input more than I expect(based how much readln function are) this problem( or behaviour) is quite annoying the input process. for better understanding this is my script:

{empty}
{sorry I don't know how to copy script from free pscal :-[

any help pleaaase...

440bx

  • Hero Member
  • *****
  • Posts: 3921
Re: readln executed before writeln
« Reply #1 on: December 01, 2019, 12:20:29 pm »
Any chance you can post the code ?... it would make it a lot easier to help you.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: readln executed before writeln
« Reply #2 on: December 01, 2019, 12:33:41 pm »
{sorry I don't know how to copy script from free pscal

Copy the code and just paste it between the [code] [/code] tags.
Example:
[code=pascal]
program foo;
begin
  writeln('foo');
end.
[/code]

It will show up like this
Code: Pascal  [Select][+][-]
  1. program foo;
  2. begin
  3.   writeln('foo');
  4. end.
  5.  

The "=pascal" part tells the forum software to use the highlighter for pascal.

Bart
« Last Edit: December 01, 2019, 11:10:07 pm by Bart »

homojavanicus

  • Newbie
  • Posts: 4
Re: readln executed before writeln
« Reply #3 on: December 01, 2019, 12:55:35 pm »
okay I will do  it later. I have something to do now. thank you man!

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: readln executed before writeln
« Reply #4 on: December 01, 2019, 05:16:20 pm »
{sorry I don't know how to copy script from free pscal :-[

Canonical advice page in the wiki for new users of the forum: Forum :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018