Recent

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

homojavanicus

  • Newbie
  • Posts: 2
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: 1272
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.
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 3547
    • 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: 2
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: 2141
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 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.