Boucle while et opérateur <

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #224311 quote
    TalaventeTalavente
    Participant
    New

    Bonjour,

    Pour me familiariser et comprendre le comportement des boucles je fais quelques exercices….en voici un qui m’interroge

    defparam drawonlastbaronly=true
    
    x=1
    
    count=11
    
    if islastbarupdate then
    //i=0
    While i<x do
    for i = 0 to x do
    count= count-1
    i=i+1
    Drawtext(count,barindex-count,high+3) coloured(255,0,0)
    next
    wend
    Endif
    
    return

    Pourquoi while fait 2 boucles ici sachant que i est inférieur à 1 dans le deuxième test…..?

    C’est comme si l’opérateur vaut =

    Une idée svp

    2023-11-26_13h28_59.png 2023-11-26_13h28_59.png
    #224348 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Bonjour,

    la boucle while est éxécutée une fois pour i=0, pendant cette éxécution, elle contient une autre boucle en for to next celle-ci, qui va de 0 à x ( qui vaut 1) donc qui va s’éxécuter 2 fois affichant ainsi 2 drawtext, sans qu’on aille faire une 2e occurrence de la boucle while ensuite, donc pas de souci.

    Talavente thanked this post
    #224390 quote
    TalaventeTalavente
    Participant
    New

    Bonjour,

    le souci en fait c’est moi, j’ai mal interprété Next

    merci

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Boucle while et opérateur <


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Talavente @talavente Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by TalaventeTalavente
2 years, 9 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/26/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...