what’s the result of this code ? thank you in advance !
i:= str.length-1;
WHILE ( str[i]=' ') DO
i:=i-1;
END_WHILE
str.length := i+1;
what’s the result of this code ? thank you in advance !
i:= str.length-1;
WHILE ( str[i]=' ') DO
i:=i-1;
END_WHILE
str.length := i+1;
Why not run it and find out?
you probably need to translate it to a specific language to be able to use it
Thank you for you answer @ilenia , i have a question, if the WHILE DO in that algorithm is the same as do…while in JS ?
and if you know some pure algorithm lessons or courses ? Thank you in advance
the do…while in javascript execute the code at least once, then check if the condition is true to do more iterations
a while loop execute only and until the condition is true
I do not know of any algorithm lessons that are language-agnostic, but any algorithm lesson in a specific language can then by applied to any other language
Thank you so much for your time and your answer.