Results 1 to 2 of 2

Thread: perl help for a newbie please

  1. #1
    Join Date
    May 2003

    perl help for a newbie please

    if $x = 10 then the statement, if ($x++ == 10) { print("7\n")} is true, but could someone please explain to me in very plain terms, why it is true. I would have thought that it was false because 10 incremented by 1 = 11, thank you.

  2. #2
    Join Date
    Nov 2002
    Dartmoor [Holiday]
    $x++ returns x (i.e. 10) then increments it by one, like doing this:

    if ($x == 10)
    $x = $x + 1

    If you use ++$x, it first increments the variable then returns it.

    "If youíre not using valid HTML, then you havenít created a Web page. You may have created something else, but it isnít a Web page." - Joe Clark

    Do something amazing (USA) | Make Poverty History

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center