create account

My Coding Quiz #27 by eniolw

View this thread on: hive.blogpeakd.comecency.com
· @eniolw ·
$8.43
My Coding Quiz #27
<div class="text-justify">

<center><h2>My Coding Quiz #27 👨‍💻🛠️🧩</h2></center>

<p>Welcome to the new installment of my series of <b>Coding Quizzes</b>, in which you will be able to test your knowledge and skills about programming and software development in a simple and fun way. If you want to learn more about it visit <a href="/@eniolw">my blog</a> here on Hive and the <a href="/@eniolw/my-coding-quiz-1">first post</a> where I introduced it.</p>

<h3>Without further ado, here's the riddle...</h3>

<br>
<center>
<img src="https://images.ecency.com/DQmeK4ruMLAqwdFNuLeorZJ4VBVkSCnkBVvmf1Sux1engf2/quiz_img_en.png" alt="Quiz">
<h6>By @eniolw</h6>
</center>

<br><center><h3>What's your choice?</h3></center>

<p><b>Solution to the <a href="/@eniolw/my-coding-quiz-26">previous quiz</a>:</b> <b>int(3)</b>. The code is quite self-explanatory for PHP programmers. They know that a bloddy overlooked semicolon can cause problems in this language.</p>

<p>In an interactive PHP session, lines 1 and 2 are omitted, because line 1 has a syntax error that is actually detected on line 2. The interpreter will tell you that <code>$var1</code> does not exist and that is because we did not add a semicolon to line 1. As a consequence, the interpreter will execute lines 3 and 4, which are valid code.</p>

<p>Line 3 introduces the <code>??</code> operator called <i>Null Coalescing Operator</i>. It is new in PHP 7 and what it does is simplify the old use of the ternary operator in conjunction with the <code>isset</code> function to determine if a variable exists and is not null. Thus, if the first variable exists and is not null, it will be chosen, otherwise, the second is chosen.</p>

<p>In our code, since <code>$var1</code> does not exist, the null coalescent operator will choose <code>3</code> and this value will be assigned to <code>$var2</code>. </p>

<p>The final line uses the <code>var_dump</code> function which simply prints the contents of the given variable and its data type. This produces the output that is <b>int(3)</b>.</p>

<p>The hiver @dobro2020 has solved this quiz perfectly. Congratulations.</p>

<hr>

<p>If you want to blog about computer science and programming content, I invite you to join <a href="/">Hive</a> and participate in its communities, such as <a href="/created/hive-196387">STEM-social</a>, <a href="/created/hive-154226">Develop Spanish</a>, <a href="/created/hive-169321">Programming & Dev</a> and others.</p>

<hr>

<center><h2>Mi Quiz de Programación #27 👨‍💻🛠️🧩</h2></center>

<p>Bienvenido a mi nueva serie de <b>Quizzes de Programación</b>, en la cual podrás poner a prueba tus conocimientos y habilidades sobre programación y desarrollo de software de una manera sencilla y divertida.  Si quieres aprender más sobre ella visita <a href="/@eniolw">mi blog</a> aquí en Hive y el <a href="/@eniolw/my-coding-quiz-1">primer post</a> donde la presenté.</p>

<h3>Sin más preámbulos, he aquí el acertijo...</h3>

<br>
<center>
<img src="https://images.ecency.com/DQmaGN9roSuj4YvYSdHt5fvf57r8sy1azffpSDpDtQHypcq/quiz_img_es.png" alt="Quiz">
<h6>Por @eniolw</h6>
</center>

<br><center><h3>¿Cuál es tu elección?</h3></center>

<p><b>Solución al <a href="/@eniolw/my-coding-quiz-26">quiz anterior</a>:</b> <b>int(3)</b>. El código es bastante autoexplicativo para los programadores de PHP. Estos saben que un bendito punto y coma pasado por alto puede causar problemas en este lenguaje.</p>

<p>En una sesión interactiva de PHP, las líneas 1 y 2 son omitidas, por cuanto la línea 1 posee un error de sintaxis que realmente es detectado en la línea 2. El intérprete te dirá que <code>$var1</code> no existe y eso se debe a que no colocamos punto y coma a la línea 1. Como consecuencia, el intérprete pasará a ejecutar las líneas 3 y 4 que sí son código válido.</p>

<p>La línea 3 presenta el operador <code>??</code> llamado <i>Operador coalescente nulo</i>. Es una novedad de PHP 7 y lo que hace es simplificar el antiguo uso del operador ternario en conjunción con la función <code>isset</code> para determinar si una variable existe y no es nula. Así, si la primera variable existe y no es nula, se escogerá, sino, se escoge la segunda.</p>

<p>En nuestro código, por cuanto <code>$var1</code> no existe, el operador coalescente nulo escogerá <code>3</code> y este valor se asignará a <code>$var2</code>.</p>

<p>La línea final usa la función <code>var_dump</code> que simplemente imprime el contenido de la variable dada y su tipo de dato. Con ello se obtiene la salida que es <b>int(3)</b>.</p>

<p>El hiver @dobro2020 ha resuelto este quiz perfectamente. Felicidades.</p>

<hr>

<p>Si quieres bloguear sobre contenido informático y de programación, te invito a unirte a <a href="/">Hive</a> y participar en sus comunidades, tales como <a href="/created/hive-196387">STEM-social</a>, <a href="/created/hive-154226">Develop Spanish</a>, <a href="/created/hive-169321">Programming & Dev</a> y otras.</p>

</div>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 556 others
properties (23)
authoreniolw
permlinkmy-coding-quiz-27
categoryhive-196387
json_metadata"{"image":["https://images.ecency.com/DQmeK4ruMLAqwdFNuLeorZJ4VBVkSCnkBVvmf1Sux1engf2/quiz_img_en.png","https://images.ecency.com/DQmaGN9roSuj4YvYSdHt5fvf57r8sy1azffpSDpDtQHypcq/quiz_img_es.png"],"tags":["hive-196387","programming","coding","python","development","quiz","neoxian","proofofbrain","creativecoin","spanish"],"description":"My Coding Quiz #27 Welcome to the new installment of my series of Coding Quizzes, in which you will be able to test your knowledge and skills about programming and software development in a fun way","app":"ecency/3.0.36-vision","format":"markdown+html","image_ratios":["0.9828","0.9828"]}"
created2023-10-15 01:31:48
last_update2023-10-15 01:31:48
depth0
children3
last_payout2023-10-22 01:31:48
cashout_time1969-12-31 23:59:59
total_payout_value4.260 HBD
curator_payout_value4.168 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,956
author_reputation255,389,091,263,375
root_title"My Coding Quiz #27"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,000,047
net_rshares20,572,395,145,455
author_curate_reward""
vote details (620)
@dobro2020 ·
Que cosas raras hace php jajajaj
properties (22)
authordobro2020
permlinkre-eniolw-20231014t223314677z
categoryhive-196387
json_metadata{"tags":["hive-196387","programming","coding","python","development","quiz","neoxian","proofofbrain","creativecoin","spanish"],"app":"ecency/3.0.43-mobile","format":"markdown+html"}
created2023-10-15 01:33:15
last_update2023-10-15 01:33:15
depth1
children0
last_payout2023-10-22 01:33:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length32
author_reputation66,396,989,968,772
root_title"My Coding Quiz #27"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,000,063
net_rshares0
@stemsocial ·
re-eniolw-my-coding-quiz-27-20231016t210959185z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-eniolw-my-coding-quiz-27-20231016t210959185z
categoryhive-196387
json_metadata{"app":"STEMsocial"}
created2023-10-16 21:09:57
last_update2023-10-16 21:09:57
depth1
children0
last_payout2023-10-23 21:09:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,918,491,691,707
root_title"My Coding Quiz #27"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,050,578
net_rshares0
@visualblock ·
<center>

![](https://images.ecency.com/DQmeUXCY8732hkoJpZcnSxQD7NbHUbhe9d8wKYmqN3rN56e/testigo_hispapro.png)

<sup>
Has sido curado por @visualblock / You've been curated by @visualblock 
Bienvenidas delegaciones / Delegations welcome
[Trail de Curación / Curation Trail](https://hive.vote/dash.php?trail=visualblock&i=1)

[Vota por nuestro Testigo aliado - @hispapro](https://vote.hive.uno/@hispapro) / [Vote for our allied Witness - @hispapro](https://vote.hive.uno/@hispapro) 
[Más información sobre el testigo aquí](https://ecency.com/hive-111111/@hispapro/witness-announcement-descubre-el-nuevo) / [More information about the witness here](https://ecency.com/hive-111111/@hispapro/witness-announcement-descubre-el-nuevo)

</sup>

</center>
properties (22)
authorvisualblock
permlinkre-eniolw-20231014t225420366z
categoryhive-196387
json_metadata{"tags":["hive-196387","programming","coding","python","development","quiz","neoxian","proofofbrain","creativecoin","spanish"],"app":"ecency/3.0.36-vision","format":"markdown+html"}
created2023-10-15 03:54:21
last_update2023-10-15 03:54:21
depth1
children0
last_payout2023-10-22 03:54:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length745
author_reputation152,604,757,461,690
root_title"My Coding Quiz #27"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,002,835
net_rshares0