Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » Erreur syntaxe dans un programme en Basic Casio et je ne sais pas
Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Erreur syntaxe dans un programme en Basic Casio et je ne sais pas

Posté le 20/12/2023 17:50

Salut tous le monde,
j'ai une erreur de syntaxe dans ce code et je ne sais pas comment le regler:

1 -> Q
0 -> M
"Λ≡∡=>" -> Str 1
{1, 5, 5, 10, 0, 0 -> List 9
{5, 1 -> List 8
{7, 17 -> Dim Mat K
Locate 1, 1, "S:"
Locate 1, 3, "P:"
Locate 1, 4, "N:"
Locate 1, 5, "M:"
Locate 1, 6, "E:"
Locate 1, 7, "$:"
Locate 3, 1, List 9[1
Locate 3, 3, List 9[2
Locate 3, 4, List 9[3
Locate 3, 5, List 9[4
Locate 3, 6, List 9[5
Locate 3, 7, List 9[6
While 1
    If M = 0 :Then
        Locate List 8[1], List 8[2], " "
    IfEnd
Locate List 8[1], List 8[2], StrMid(Str 1, Q, 1)

le curseur est sur la derniere ligne :
Locate List 8[1], List 8[2], StrMid(Str 1, Q, 1 ICI)

Merci d'avance


Potter360 Hors ligne Rédacteur Points: 1221 Défis: 2 Message

Citer : Posté le 20/12/2023 17:54 | #


Tu n'as pas fermé ton While 1 par un WhileEnd je pense que c'est pour ça
Globalement, coder. Mal, mais coder.
Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Citer : Posté le 20/12/2023 17:56 | #


Mais.... comment j'ai pu faire une telle erreur merci, ca marche!
Ne vous arrêtez pas quand vous êtes fatigé(e), arrêtez vous quand vous avez terminez.
Ptitjoz Hors ligne Membre Points: 225 Défis: 10 Message

Citer : Posté le 21/12/2023 08:20 | #


C'est à cause des habitudes prises en python.
Les fins d'indention ferment les if while for etc
Un peu poète, un peu geek, un peu rêveur, un peu écolo.

Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Citer : Posté le 21/12/2023 14:29 | #


Oui je crois que c'est pour ca. En plus, j'ai pris du temps a comprendre que si tu mets 4 conditions, il faut mettre 4 IfEnd
Ne vous arrêtez pas quand vous êtes fatigé(e), arrêtez vous quand vous avez terminez.
Calcloverhk Hors ligne Membre Points: 333 Défis: 10 Message

Citer : Posté le 21/12/2023 15:27 | #


What kind of error message did you get in C.Basic? I was confused because you should get the "While w/o WhileEnd"/"Missing WhileEnd" message instead of just "syntax error".
C.Basic Wiki Project progress as of 2024/2/12
   30%


Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Citer : Posté le 21/12/2023 16:14 | #


Actually, when there is a missing WhileEnd or IfEnd, it shows a Syntax ERROR. But maybe we don't have the same calculator model. I have a graph 35+e.
Ne vous arrêtez pas quand vous êtes fatigé(e), arrêtez vous quand vous avez terminez.
Calcloverhk Hors ligne Membre Points: 333 Défis: 10 Message

Citer : Posté le 21/12/2023 20:50 | #


Ah, I kind of figured out why your error message wasn't "Missing WhileEnd". Apparantly it is only triggered when running "While (false)" as it looks for and jumps to WhileEnd to skip the while loop. Here you used "While 1" in which C.Basic just "labels its position and waits until reaching WhileEnd for looping" without actually looking for WhileEnd immediately (not 100% sure though). This might be the way the syntax system in C.Basic works (to speed up interpretion) and as such it's so lenient that even codes like "If 0ThenA->BElseA->CIfEnd" is allowed and functional x).

Interestingly you stated your cursor is located within StrMid() when the error pop-up shows up, which indicates something went wrong on StrMid() and not the while loop, but I don't see any syntax issues in this part. Moreover, simply running "WhileEnd" or "IfEnd" does not show any error pop-up. I thought you got the "Syntax ERROR" pop-up at first but this seems incorrect. Maybe you mean your calc shows erroneous results on the screen after running the codes?
C.Basic Wiki Project progress as of 2024/2/12
   30%


Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Citer : Posté le 21/12/2023 22:33 | #


I understand your reasoning and it popped up me a Syntax ERROR. And then, when I added the WhileEnd, it worked perfectly. So I don't know
Ne vous arrêtez pas quand vous êtes fatigé(e), arrêtez vous quand vous avez terminez.
Tuper4 Hors ligne Membre Points: 832 Défis: 19 Message

Citer : Posté le 09/01/2024 19:26 | #


Calcloverhk a écrit :
Ah, I kind of figured out why your error message wasn't "Missing WhileEnd". Apparantly it is only triggered when running "While (false)" as it looks for and jumps to WhileEnd to skip the while loop. Here you used "While 1" in which C.Basic just "labels its position and waits until reaching WhileEnd for looping" without actually looking for WhileEnd immediately (not 100% sure though). This might be the way the syntax system in C.Basic works (to speed up interpretion) and as such it's so lenient that even codes like "If 0ThenA->BElseA->CIfEnd" is allowed and functional x).

Interestingly you stated your cursor is located within StrMid() when the error pop-up shows up, which indicates something went wrong on StrMid() and not the while loop, but I don't see any syntax issues in this part. Moreover, simply running "WhileEnd" or "IfEnd" does not show any error pop-up. I thought you got the "Syntax ERROR" pop-up at first but this seems incorrect. Maybe you mean your calc shows erroneous results on the screen after running the codes?
I nos understand Why there wasn't a "missing whileend": because I was coding on the native casio language which, when I wrote the post, thought was called C.Basic. I realized this when I tried C.Basic and saw that when you don't put a WhileEnd, it says Missing WhileEnd which is not the case on the native Casio language. I hope you understand what I said

EDIT: I changed the name of the topic.
Ne vous arrêtez pas quand vous êtes fatigé(e), arrêtez vous quand vous avez terminez.

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 29 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd