`[]': no impli cit conversion of Symbol into Integer (TypeError)

Par TaderFit, il y a 8 ans


Bonjour,

Voila je rencontre un petit problème avec mon code.

Ce que je fais

Décrivez ici votre code ou ce que vous cherchez à faire

def enregistrement file1=File.open("Gestion/Administration","a") fiche.each do |line| file1.write "NOM: #{line[:nom]}\tNotes: #{line[:notes]}\tMoyenne: #{isMoyenne}\n\n" end file1.close end

Ce que je veux

en faite c'est une methode qui vas me permetre l'orsque je l'appele d'enregistré le contenue des variables dans un fichier mais bon voila la le resulta :

Ce que j'obtiens

B:/ruby/reprise/TD1.rb:51:in []': no implicit conversion of Symbol into Integer (TypeError) from B:/ruby/reprise/TD1.rb:51:in ' block in enregistrement' from B:/ruby/reprise/TD1.rb:50:ineach'
from B:/ruby/reprise/TD1.rb:50:in enregistrement' from TD2.rb:65:in<main>'

Aucune réponse